Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
DateTime preDate = TodayDate.AddDays(-3);
                        string filter1 = "[Start] >= '" +preDate.ToString("g",
           CultureInfo.CurrentCulture) + "' AND [End] <= '" + TodayDate.ToString("g",
           CultureInfo.CurrentCulture) + "'";
                        oItems.IncludeRecurrences = true;
                        oItems.Sort("[Start]", Type.Missing);
                        oItems = oItems.Find(filter1);
                        
                       int total= oItems.Count; 
i am getting 0 items
 
In my outlook i have the items also.
 
how to get outlook sentitems b/w two dates.
 
pls help me.
Posted 4-Oct-12 0:35am
Edited 4-Oct-12 0:37am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

--Solved--
  Outlook._NameSpace olNs;
  Outlook.MAPIFolder oSents;
  Outlook.Items oItems;
  olNs = olApp.GetNamespace("MAPI");
  oSents = olNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail);
  oItems = oSents.Items;
DateTime fromDate= Convert.ToDateTime("11/21/2013");
DateTime toDate= Convert.ToDateTime("11/28/2013")
 oItems = oSents.Items.Restrict("[ReceivedTime]>'" + fromDate + "' AND [ReceivedTime]<'" + toDate+ "'");
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,130
1 DamithSL 5,089
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,647
4 Kornfeld Eliyahu Peter 4,409


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 28 Nov 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100