protected override void CacheMetadata(CodeActivityMetadata metadata) { if (KnownFolder != 0 && (MailFolder == null || MailFolder.Expression == null)) { MailFolder = new InArgument <string>(KnownFolder.ToString()); KnownFolder = KnownFolders.None; } base.CacheMetadata(metadata); }
/// <summary> /// Converts the <paramref name="knownFolder"/> to a string and then calls the /// <see cref="InMemoryFileSystem.GetPath(string)"/> method with it. /// Then returns the full path of the result. /// </summary> /// <param name="fileSystem"> /// An <see cref="InMemoryFileSystem"/> instance for which the <see cref="KnownFolder"/> /// should be located. /// </param> /// <param name="knownFolder"> /// The <see cref="KnownFolder"/> value to be located for the specified <paramref name="fileSystem"/>. /// </param> /// <returns> /// A <see cref="StoragePath"/> which locates the specified <paramref name="knownFolder"/> /// within the provided <paramref name="fileSystem"/>. /// </returns> /// <exception cref="ArgumentException"> /// <paramref name="knownFolder"/> is an invalid <see cref="KnownFolder"/> enumeration value. /// </exception> public StoragePath GetPath(InMemoryFileSystem fileSystem, KnownFolder knownFolder) { _ = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); if (!EnumInfo.IsDefined(knownFolder)) { throw new ArgumentException(ExceptionStrings.Enum.UndefinedValue(knownFolder), nameof(knownFolder)); } return(fileSystem.GetPath(knownFolder.ToString()).FullPath); }
protected override Task <List <MailMessage> > GetMessage(AsyncCodeActivityContext context, CancellationToken cancellationToken) { string account = Account.Get(context); string filter = Filter.Get(context); string folderpath = MailFolder.Get(context); int top = Top.Get(context); if (KnownFolder != 0) { KnownFolders result = KnownFolders.None; if (!Enum.TryParse(folderpath, ignoreCase: true, out result)) { folderpath = KnownFolder.ToString() + "\\" + folderpath; } } MAPIFolder mAPIFolder = GetFolder.GetFolders(folderpath, account); List <MailMessage> mailMessages = GetMessages.Messages(mAPIFolder, top, filter, OnlyUnreadMessages, MarkAsRead, true, TimeOrder, cancellationToken); return(StartNew(() => mailMessages)); }
public override StoragePath GetPath(KnownFolder knownFolder) => GetPath(knownFolder.ToString());