예제 #1
0
        private static List <EmailParsingData> GetDeliveryReportList(string filter)
        {
            try
            {
                var           mailBoxContent = new List <EmailParsingData>();
                Outlook.Items folderItems    = null;

                Outlook.MAPIFolder inboxFolder = null;
                foreach (dynamic folder in ThisAddIn.thisApplication.GetNamespace("MAPI").Folders)
                {
                    var subFolders = GpiOutlookWrapper.GetFolder(folder.FolderPath);
                    foreach (Outlook.MAPIFolder subFolder in subFolders.Folders)
                    {
                        if (subFolder.FullFolderPath.Contains("Уведомления о прочтении") &&
                            (subFolder.FullFolderPath.Contains("Канцелярия") || subFolder.FullFolderPath.Contains("kancelaria")))
                        {
                            inboxFolder = subFolder;
                        }
                    }

                    Marshal.ReleaseComObject(subFolders);
                }

                if (inboxFolder == null)
                {
                    return(mailBoxContent);
                }

                folderItems = inboxFolder.Items;
                folderItems.Sort("[CreationTime]", true);

                var item = folderItems.Find(filter);
                while (item != null)
                {
                    var parsingData = new EmailParsingData();
                    parsingData.Subject      = item.Subject;
                    parsingData.ItemClass    = item.MessageClass;
                    parsingData.CreationTime = item.CreationTime;
                    mailBoxContent.Add(parsingData);
                    Marshal.ReleaseComObject(item);
                    item = folderItems.FindNext();
                }

                return(mailBoxContent);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #2
0
        private static EmailParsingData GetEmailParsingData(dynamic item)
        {
            var parsingData = new EmailParsingData
            {
                EntryId              = item.EntryID,
                CreationTime         = item.CreationTime,
                Subject              = item.Subject ?? string.Empty,
                ItemClass            = item.MessageClass,
                LastModificationTime = item.LastModificationTime,
                ConversationId       = item.ConversationID,
                DisplayTo            = GetDisplayTo(item),
                Status = EmailStatus.Unknown
            };

            return(parsingData);
        }