use of microsoft.exchange.webservices.data.core.PropertySet in project iaf by ibissource.
the class ExchangeMailListener method getStringFromRawMessage.
public String getStringFromRawMessage(Object rawMessage, Map threadContext) throws ListenerException {
Item item = (Item) rawMessage;
try {
XmlBuilder emailXml = new XmlBuilder("email");
EmailMessage emailMessage;
PropertySet ps;
if (isSimple()) {
ps = new PropertySet(EmailMessageSchema.Subject);
emailMessage = EmailMessage.bind(exchangeService, item.getId(), ps);
addEmailInfoSimple(emailMessage, emailXml);
} else {
ps = new PropertySet(EmailMessageSchema.DateTimeReceived, EmailMessageSchema.From, EmailMessageSchema.Subject, EmailMessageSchema.Body, EmailMessageSchema.DateTimeSent);
emailMessage = EmailMessage.bind(exchangeService, item.getId(), ps);
addEmailInfo(emailMessage, emailXml);
}
if (StringUtils.isNotEmpty(getStoreEmailAsStreamInSessionKey())) {
emailMessage.load(new PropertySet(ItemSchema.MimeContent));
MimeContent mc = emailMessage.getMimeContent();
ByteArrayInputStream bis = new ByteArrayInputStream(mc.getContent());
threadContext.put(getStoreEmailAsStreamInSessionKey(), bis);
}
return emailXml.toXML();
} catch (Exception e) {
throw new ListenerException(e);
}
}
Aggregations