Search code examples
emailoffice365exchangewebservicesplaintext

Office 365 Rest API - Retrieving plain text Email


Is there currently anyway to with the Office 365 Rest APIs to retrieve the plain text part of an email message?

From the API documents it states that the 'Body' object contains the 'ContentType' field which can either be Text or HTML. https://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#ItemBody

However whenever a multipart (HTML + plain text) message is retrieved the API only ever returns the HTML part as shown bellow:

{
  "@odata.context": "",
  "@odata.id": "",
  "Id": "",
  "Subject": "Test message",
  "BodyPreview": "This is the body",
  "Body": {
    "ContentType": "HTML",
    "Content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n</head>\r\n<body style=\"word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;\">\r\n<div>This is the body</div>\r\n</body>\r\n</html>\r\n"
  },
  "UniqueBody": {
    "ContentType": "HTML",
    "Content": "<html><body><div>\r\n<div><font face=\"Calibri,sans-serif\" size=\"2\" color=\"black\"><span style=\"font-size:14px;\">\r\n<div>This is the body</div>\r\n</span></font></div>\r\n</div>\r\n</body></html>"
  },
  "HasAttachments": false,
  "Sender": {
    "EmailAddress": {
        "Address": "",
        "Name": "Nick Maher"
    }
  },
  "DateTimeReceived": "2015-02-10T14:39:22Z",
  "DateTimeSent": "2015-02-10T14:39:21Z"
}

Is there anyway of getting the plain text part. Possibly an OData query?

Many thanks, Nick


Solution

  • No, this isn't possible. I can provide this feedback to our developers. Can you give me some background on why you need this ability? Not that I'm questioning, it's just helpful to have some context. :)