From dc26219e2650517d811bb8aeb3f377cb7fcbf6bb Mon Sep 17 00:00:00 2001 From: kaanlab Date: Tue, 2 Jun 2020 16:02:30 +0300 Subject: [PATCH] close bug #6 --- .../Properties/AssemblyInfo.cs | 4 +-- OutlookReportsAddIn/Services/MaiService.cs | 28 ++++++++----------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/OutlookReportsAddIn/Properties/AssemblyInfo.cs b/OutlookReportsAddIn/Properties/AssemblyInfo.cs index 693acc9..1d227b1 100644 --- a/OutlookReportsAddIn/Properties/AssemblyInfo.cs +++ b/OutlookReportsAddIn/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.0.0")] -[assembly: AssemblyFileVersion("2.0.0.0")] +[assembly: AssemblyVersion("2.0.0.1")] +[assembly: AssemblyFileVersion("2.0.0.1")] diff --git a/OutlookReportsAddIn/Services/MaiService.cs b/OutlookReportsAddIn/Services/MaiService.cs index 0eb8d1b..418e3ee 100644 --- a/OutlookReportsAddIn/Services/MaiService.cs +++ b/OutlookReportsAddIn/Services/MaiService.cs @@ -13,7 +13,7 @@ public IEnumerable SearchMails((DateTime startDate, DateTime endDate) date { var emailItems = new List(); emailItems.AddRange(SearchIn(datesRange, OlDefaultFolders.olFolderInbox)); - emailItems.AddRange(SearchIn(datesRange, OlDefaultFolders.olFolderOutbox)); + emailItems.AddRange(SearchIn(datesRange, OlDefaultFolders.olFolderSentMail)); emailItems.Sort((x, y) => DateTime.Compare(x.Date, y.Date)); return emailItems; @@ -22,26 +22,22 @@ public IEnumerable SearchMails((DateTime startDate, DateTime endDate) date private IEnumerable SearchIn((DateTime startDate, DateTime endDate) datesRange, OlDefaultFolders olFolder) { var emailItems = new List(); - var accounts = Globals.ThisAddIn.Application.ActiveExplorer().Session.Accounts; - foreach (Account acc in accounts) - { - var stores = acc.Session.Stores; + var stores = Globals.ThisAddIn.Application.ActiveExplorer().Session.Stores; - foreach (Store store in stores) + foreach (Store store in stores) + { + var folder = store.GetDefaultFolder(olFolder); + if (folder.FolderPath.Contains(Properties.Settings.Default.MailAddress)) { - var folder = store.GetDefaultFolder(olFolder); - if (folder.FolderPath.Contains(Properties.Settings.Default.MailAddress)) - { - var filtredItiems = folder.Items.FiltredByDates(datesRange); + var filtredItiems = folder.Items.FiltredByDates(datesRange); - foreach (var item in filtredItiems) + foreach (var item in filtredItiems) + { + if (item is MailItem) { - if (item is MailItem) - { - var olMail = ((MailItem)item); - emailItems.Add(olMail.MapToMail()); - } + var olMail = ((MailItem)item); + emailItems.Add(olMail.MapToMail()); } } }