Getting oldest mail in the inbox using EWS Managed API RRS feed

  • Question

  • We are developing an application to fetch mails from exchange server to some folder. We are subscribing to push notifications on new mail event and also periodically checking for any left out mails.

    However I want to know how can we fetch oldest mail in the inbox. How should I be writing search filter on received dates of mails? Any code example?

    Friday, February 21, 2014 10:09 AM

All replies

  • You don't need a SearchFilter just Order the Results ascending by the RecievedDateTime eg

                ItemView OldItems = new ItemView(1);
                OldItems.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Ascending);
                FindItemsResults<Item> ffRes = service.FindItems(WellKnownFolderName.Inbox, OldItems);
                if (ffRes.Items.Count > 0) {


    Monday, February 24, 2014 4:19 AM