I need to get the MimeType of an item object:
What I've got: - Item object (microsoft.exchange.webservices.data.Item) from the EWS
What I want: - The mimetype of this Item(e.g. String "text/plain")
Is there even a mimetype in exchange?
(I am using the java ews api version 1.2.0)
I have been looking for an Javamail implementation EWS which would allow me to connect to EWS as if I were connecting to any other protocol (IMAP, POP etc) over Javamail. Clearly MS does not seem interested in providing Javamail style implementation that as they provide their own open source EWS Java API (v2.0) https://github.com/OfficeDev/ews-java-api . The documentation is limited to getting started, but if you were into writing a full fledged email client then the documentation might seem lacking. Best to look at the source.
After reading through the source I found Item.getMimeContent() as the method that came closest to anything that looked like providing a content type for the message envelope. But looking at the output of that method I realized that it provides pretty much everything about the message and not just its content type.
So here are the two options that work
EmailMessage.getInternetMessageHeaders().find("Content-Type").getValue()
This provides the exact content type only. Any other part (e.g boundary, information or charset) is not present. However this option will work for your purpose since you are only interested in mime type