Search in sources :

Example 6 with Item

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);
    }
}
Also used : Item(microsoft.exchange.webservices.data.core.service.item.Item) ItemView(microsoft.exchange.webservices.data.search.ItemView) ListenerException(nl.nn.adapterframework.core.ListenerException) SearchFilter(microsoft.exchange.webservices.data.search.filter.SearchFilter) ServiceLocalException(microsoft.exchange.webservices.data.core.exception.service.local.ServiceLocalException) ListenerException(nl.nn.adapterframework.core.ListenerException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Aggregations

Item (microsoft.exchange.webservices.data.core.service.item.Item)6 ServiceLocalException (microsoft.exchange.webservices.data.core.exception.service.local.ServiceLocalException)4 EmailMessage (microsoft.exchange.webservices.data.core.service.item.EmailMessage)4 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)4 ListenerException (nl.nn.adapterframework.core.ListenerException)4 ItemView (microsoft.exchange.webservices.data.search.ItemView)3 SearchFilter (microsoft.exchange.webservices.data.search.filter.SearchFilter)3 IOException (java.io.IOException)2 URISyntaxException (java.net.URISyntaxException)2 MessagingException (javax.mail.MessagingException)2 ExchangeService (microsoft.exchange.webservices.data.core.ExchangeService)2 PropertySet (microsoft.exchange.webservices.data.core.PropertySet)2 XmlBuilder (nl.nn.adapterframework.util.XmlBuilder)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 OutputStream (java.io.OutputStream)1 URI (java.net.URI)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Date (java.util.Date)1