Pushpendra Maheshwari Pushpendra Maheshwari - 1 year ago 101
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download