none
Get plain text body and html body of an EmailMessage in EWS managed api RRS feed

  • Question

  • Hi,

    I have trouble getting both the plain text and html body of a message. I set the RequestedBodyType to BodyType.Html, by that way I could get the Html format but now I need Text too. Is there a way to attain both text and body of an EmailMessage?

    Monday, February 25, 2019 1:12 PM

All replies

  • You can't request both to these properties in the same request, if they have both been set on a Message then if you request the MimeContent https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/mimecontent you will see both the Text and HTML bodypart of the Message in the Mime content that is returned.

    Another option is this https://social.msdn.microsoft.com/Forums/lync/en-US/4d074053-db71-4aba-9c79-3a4a8cbe880f/retrieve-both-html-and-text-body-via-ews?forum=exchangesvrdevelopment

    However because of the way the best body algorithm works https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxbbody/1d211dcd-2896-4b9a-bcdb-a2b5763a57f4 it won't always work.

    Cheers
    Glen

    Monday, February 25, 2019 11:30 PM
  • Thanks a ton for the help! I figured out a work around and converted HTML to Text once I Got the HTML Body.
    Wednesday, February 27, 2019 6:56 AM