Click here to Skip to main content
Rate this: bad
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 3-Oct-12 23:35pm
Edited 3-Oct-12 23:37pm

1 solution

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

Solution 1

  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+ "'");

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

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