public Task <List <MailMessage> > GetMessages(AsyncCodeActivityContext context, CancellationToken cancellationToken) { string account = Account.Get(context); string filter = Filter.Get(context); string folderpath = MailFolder.Get(context); int top = Top.Get(context); return(Task.Factory.StartNew(() => OutlookAPI.GetMessages(account, folderpath, top, filter, OnlyUnreadMessages, MarkAsRead, true, cancellationToken))); }
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)); }