javaexchangewebservicesewsjavaapi

EWS Java API ItemView change default orderBy value


I'm using the EWS Java API 2.0 in order to fetch items from a mailbox. Simply I need to know the Java equivalant of following C# code snippet.

ItemView view = new ItemView(50); 
view.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);

There is no method called view.setOrderBy() in Java API. How can I change the default value of itemview orderBy property? And what is the default value of that property? Any help is appreciated.


Solution

  • The method you require is called view.getOrderBy() The below code is the Java equivalent of the C# code snippet you provided:

    ItemView view = new ItemView(50); 
    view.getOrderBy().add(ItemSchema.DateTimeReceived, SortDirection.Descending);