Search code examples
exchangewebservicesewsjavaapi

Retrieve only email messages from inbox in EWSJavaAPI


I am using EWS Java API to read Outlook inbox. The inbox can contain contacts items and calendar items.

I want to retrieve only the email messages, how to do that?


Solution

  • This can be done by checking on the item type as follows:

    if(myItem.getItemClass().equals("IPM.Note")){
       // this is an email
    }
    

    all item types can be found here:

    http://msdn.microsoft.com/en-us/library/office/bb176446(v=office.12).aspx