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.
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.
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.
This example on MSDN shows how to use the OrderBy
property of ItemView
to sort results:
iv.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With