Pushpendra Maheshwari Pushpendra Maheshwari - 29 days ago 13x
C# Question

How to get emails based on received date

How to get emails from Outlook mail Item based on email received date?

using OutLook = Microsoft.Office.Interop.Outlook;
OutLook.Application outlookObj;
OutLook.NameSpace olintNS;
OutLook.MailItem mailitem;
mailitem = outlookObj.CreateItem(OutLook.OlItemType.olMailItem);

We want mailitem get only those mail received today.

Something like a filter on received date.


Open the Inbox folder using Namespace.GetDefaultFolder(olFolderInbox), then call MAPIFolder.Itenms.Restrict on the ReceivedTime being in the range of, for example, 7/30/2016 and 7/31/2016.