none
EWS API - Last email received datetime for shared mailbox RRS feed

  • Question

  • Hello All,

    We are using EWS API to integrate mails to our system- please let us know there is any method available in API to get the last email received in a specific mailbox ?

    Thanks,

    Fazil

    Wednesday, October 24, 2018 11:59 AM

All replies

  • Just use a FindItems request on the Inbox https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-work-with-exchange-mailbox-items-by-using-ews-in-exchange by default EWS will return the last email in the Inbox as the first result in the result set. While this is not guaranteed to be the last email that the Mailbox received (eg the user may have deleted that already) it will probably do what you want.

    Cheers
    Glen

     
    Wednesday, October 24, 2018 10:12 PM
  • using Microsoft.Exchange.WebServices.Data;
    
    var service = new ExchangeService();
    var inbox = new FolderId(WellKnownFolderName.Inbox);
    var iv = new ItemView(500);
    
    iv.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);
    
    var items = service.FindItems(inbox, iv);
    if (items.TotalCount > 0)
    {
    }

    Thursday, October 25, 2018 7:38 AM
  • Hi muhammed,

    Did you resolved your problem ? Please remember to mark the replies as answers if they helped. Please help us close the thread. Thank you for your understanding.

    if your issue is still exist then let us know about that, we will try to suggest you further to solve the issue.

    Regards,

    Simon



    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Friday, October 26, 2018 3:23 AM