Office 365 Rest API - Retrieving plain text Email

后端 未结 2 1236
野的像风
野的像风 2021-01-22 02:50

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

相关标签:
2条回答
  • 2021-01-22 03:48

    Just wanted to give an update - you can now use the Microsoft Graph REST API to get messages returned in text format.

    Note that this feature is currently in preview only. In general, we recommend using preview features only in non-production apps, as they may change without notice.

    I listed an example below. The related documentation for Microsoft Graph - Get and List messages - will be updated within the next day.

    This example shows how to use a Prefer: outlook.body-content-type="text" header to get the body and uniqueBody of the specified message in text format.

    Prefer: outlook.body-content-type="text"
    
    GET https://graph.microsoft.com/beta/me/messages('AAMkAGI1AAAoZCfHAAA=')?$select=subject,body,bodyPreview,uniqueBody
    

    Here is the response. Note: The response includes a Preference-Applied: outlook.body-content-type header to acknowledge the Prefer: outlook.body-content-type request header.

    HTTP/1.1 200 OK
    Content-type: application/json
    Preference-Applied: outlook.body-content-type="text"
    Content-length: 1550
    
    {
        "@odata.context":"https://graph.microsoft.com/beta/$metadata#users('cd209b0b-3f83-4c35-82d2-d88a61820480')/messages(subject,body,bodyPreview,uniqueBody)/$entity",
        "@odata.etag":"W/\"CQAAABYAAABmWdbhEgBXTophjCWt81m9AAAoZYj4\"",
        "id":"AAMkAGI1AAAoZCfHAAA=",
        "subject":"Welcome to our group!",
        "bodyPreview":"Welcome to our group, Dana! Hope you will enjoy working with us !\r\n\r\nWould you like to choose a day for our orientation from the available times below:\r\n\r\n\r\nDate\r\n        Time\r\n\r\nApril 14, 2017\r\n        1-3pm\r\n\r\nApril 21, 2017\r\n        10-12noon\r\n\r\n\r\n\r\nTh",
        "body":{
            "contentType":"text",
            "content":"Welcome to our group, Dana! Hope you will enjoy working with us [\ud83d\ude0a] [\ud83d\ude0a] [\ud83d\ude0a] [\ud83d\ude0a] [\ud83d\ude0a] !\r\n\r\nWould you like to choose a day for our orientation from the available times below:\r\n\r\n\r\nDate\r\n        Time\r\n\r\nApril 14, 2017\r\n        1-3pm\r\n\r\nApril 21, 2017\r\n        10-12noon\r\n\r\n\r\n\r\nThanks!\r\n\r\n"
        },
        "uniqueBody":{
            "contentType":"text",
            "content":"Welcome to our group, Dana! Hope you will enjoy working with us [\ud83d\ude0a] [\ud83d\ude0a] [\ud83d\ude0a] [\ud83d\ude0a] [\ud83d\ude0a] !\r\nWould you like to choose a day for our orientation from the available times below:\r\n\r\nDate\r\n        Time\r\n\r\nApril 14, 2017\r\n        1-3pm\r\n\r\nApril 21, 2017\r\n        10-12noon\r\n\r\n\r\nThanks!\r\n"
        }
    }
    

    Hope this helps!

    0 讨论(0)
  • 2021-01-22 03:49

    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. :)

    0 讨论(0)
提交回复
热议问题