Click here to Skip to main content
12,448,003 members (83,985 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# 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
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 | Mobile
Web01 | 2.8.160811.3 | Last Updated 28 Nov 2013
Copyright © CodeProject, 1999-2016
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