Click here to Skip to main content
13,149,073 members (57,978 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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
Updated 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170924.2 | Last Updated 28 Nov 2013
Copyright © CodeProject, 1999-2017
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