Compartir a través de


Programmatically getting the MIME content of an outlook message using Microsoft Graph API

“How to get the MIME content of a given outlook message using Microsoft Graph API?”. This is one of the oldest request that i used to get from the custom app developers using Microsoft Graph API that i interact with Smile

The capability to get MIME message body is currently available only in the /beta version. As i updated earlier, similar to any other APIs in preview status, it is subject to change. So do not use this capability in production apps.

So there are two ways you can get this,

  • You can append a $value segment to a get-message operation on that message.
  • If the message is attached to an Outlook item or group post, you can append a $value segment to a get-attachment operation on that item or group post.

----

Request:
https://graph.microsoft.com/beta/me/messages/AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OABGAAAAAAAiQ8W967B7TKBjgx9rVEURBwAiIsqMbYjsT5e-T7KzowPTAAAAAAEMAAAiIsqMbYjsT5e-T7KzowPTAAEMOXaXAAA=/$value

  • Above, i pass the ID of the outlook message
  • Also, i run the query in beta endpoint

Response:

From: MyAnalytics <no-reply@microsoft.com>

To: Megan Bowen <MeganB@M365x214355.onmicrosoft.com>

Subject: MyAnalytics | Your past week

Thread-Topic: MyAnalytics | Your past week

Thread-Index: AQHUSWCwzjiRXvHVmk2zYvKObxNRHg==

X-MS-Exchange-MessageSentRepresentingType: 1

Date: Mon, 10 Sep 2018 23:47:53 +0000

Message-ID:
     <BYAPR15MB2423E0E44FB5DFC19B8039F8CD050@BYAPR15MB2423.namprd15.prod.outlook.com>

Content-Language: en-US

X-MS-Has-Attach: yes

X-MS-Exchange-Organization-SCL: -1

X-MS-TNEF-Correlator:

X-MS-Exchange-Organization-RecordReviewCfmType: 0

Content-Type: multipart/related;
     boundary="_019_BYAPR15MB2423E0E44FB5DFC19B8039F8CD050BYAPR15MB2423namp_";
     type="multipart/alternative"

MIME-Version: 1.0

--_019_BYAPR15MB2423E0E44FB5DFC19B8039F8CD050BYAPR15MB2423namp_

Content-Type: multipart/alternative;
     boundary="_000_BYAPR15MB2423E0E44FB5DFC19B8039F8CD050BYAPR15MB2423namp_"

--_000_BYAPR15MB2423E0E44FB5DFC19B8039F8CD050BYAPR15MB2423namp_

Content-Type: text/plain; charset="Windows-1252"

Content-Transfer-Encoding: quoted-printable

[MyAnalytics logo] <https://delve.office.com/?v=3Danalytics&origin=3Dweve_W=

eeklyDigest_48e23536-c12a-4ad6-b178-7a7d0be1b419>

September 2=968, 2018

Hi Megan Bowen,

MyAnalytics helps you spend your time on the people and things that matter.

[Focus time illustration]       [Calendar illustration]         [Important =

person illustration]

Protect time for your work

Minimize unproductive collaboration

Strengthen important relationships

[Secure lock illustration]

For your eyes only

Your data is private and secure. No one has access to it but you.

Find out more > <https://support.office.com/en-us/article/Privacy-guide-for=

-Microsoft-MyAnalytics-personal-dashboard-and-Outlook-add-in-8aa160dd-8aa5-=

4ab8-955b-fd009a499553?ui=3Den-US&amp;rs=3Den-US&amp;ad=3DUS>

<html> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-= 1"> <style type=3D"text/css" style=3D"display:none;"><!-- P {margin-top:0;margi= n-bottom:0;} --></style> </head> <body dir=3D"ltr"> <div id=3D"divtagdefaultwrapper" style=3D"font-size:12pt;color:#000000;font= -family:Calibri,Helvetica,sans-serif;" dir=3D"ltr"> <p style=3D"margin-top:0;margin-bottom:0">The press conference will be on M= ay 15. We arranged to have the press gather at 2pm outside the main entranc= e.</p> </div> </body> </html> --_000_MWHPR22MB100769D1513B3DC0F007B2ECD4220MWHPR22MB1007namp_--

----

For more info, you can refer the documentation here.

Hope this helps.