Skip to content

Commit

Permalink
close bug #6
Browse files Browse the repository at this point in the history
  • Loading branch information
kaanlab committed Jun 2, 2020
1 parent 7d12dbf commit dc26219
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
4 changes: 2 additions & 2 deletions OutlookReportsAddIn/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

28 changes: 12 additions & 16 deletions OutlookReportsAddIn/Services/MaiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public IEnumerable<Mail> SearchMails((DateTime startDate, DateTime endDate) date
{
var emailItems = new List<Mail>();
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;
Expand All @@ -22,26 +22,22 @@ public IEnumerable<Mail> SearchMails((DateTime startDate, DateTime endDate) date
private IEnumerable<Mail> SearchIn((DateTime startDate, DateTime endDate) datesRange, OlDefaultFolders olFolder)
{
var emailItems = new List<Mail>();
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());
}
}
}
Expand Down

0 comments on commit dc26219

Please sign in to comment.