use of microsoft.exchange.webservices.data.core.service.item.Item in project iaf by ibissource.
the class ExchangeMailListener method getRawMessage.
public Object getRawMessage(Map threadContext) throws ListenerException {
try {
ItemView view = new ItemView(1);
view.getOrderBy().add(ItemSchema.DateTimeReceived, SortDirection.Ascending);
FindItemsResults<Item> findResults;
if ("NDR".equalsIgnoreCase(getFilter())) {
SearchFilter searchFilterBounce = new SearchFilter.IsEqualTo(ItemSchema.ItemClass, "REPORT.IPM.Note.NDR");
findResults = exchangeService.findItems(folderIn.getId(), searchFilterBounce, view);
} else {
findResults = exchangeService.findItems(folderIn.getId(), view);
}
if (findResults.getTotalCount() == 0) {
return null;
} else {
return findResults.getItems().get(0);
}
} catch (Exception e) {
throw new ListenerException(e);
}
}
Aggregations