Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving emails from Exchange sorted by datetime received

When reading items from an Exchange mailbox, I'd like to be explicit in that they're picked up in order that they were received (datetime received) - earliest first.

How can I specify (on the ItemView?) the sort value(s), and sort direction?

using Microsoft.Exchange.WebServices.Data;

var service = new ExchangeService();
var inbox = new FolderId(WellKnownFolderName.Inbox);
var iv = new ItemView(500);

//how to specify sorting, if possible?

var items = service.FindItems(inbox, iv);
if (items.TotalCount > 0)
{
}

Using the Exchange Managed Web Services.

like image 859
p.campbell Avatar asked Feb 20 '12 23:02

p.campbell


People also ask

How do I check my Exchange email logs?

Step 1: Sign in with your Office 365 admin account. Step 2: On the left pane, click Exchange to open Exchange admin center. Step 3: In Exchange admin center, click mail flow on the left pane. Step 4: Click on the message trace tab on the top of the page.

How do I track an email in Exchange 2010?

Within the Exchange Management Console there is an option for Toolbox . In the toolbox is a tool called Tracking Log Explorer . You can use this tool to search for messages at a finer granularity, and without selecting specific mailboxes, but based on email addresses, etc.


1 Answers

This example on MSDN shows how to use the OrderBy property of ItemView to sort results:

   iv.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);
like image 62
reuben Avatar answered Sep 28 '22 09:09

reuben