Search code examples
javaexchange-serverexchangewebservicesexchange-server-2010ewsjavaapi

Set Content-Type as text/plain using EWS java API


I use EWS Java API to send mails through Exchange 2010. From the trace I find that content type is set as text/xml. Is there a way to send mails as plain text only?

Content-Type: text/xml

Thanks.


Solution

  • AFAIK the communication through that API goes with SOAP calls and these should have Content-Type=text/xml; charset=utf-8 - without double quotes around utf-8. EWS is quirky about that.

    I think that is what you are seeing in your trace.

    The trick is to set the BodyType to Best or HTML or Text whenever you use operations like GetItem, UpdateItem.