Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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
Updated 3-Oct-12 23:37pm
v2

1 solution

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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900