sarea
sarea

Reputation: 225

Is it possible to get email header from SENT item with OWA rest-api?

According to this question Is it possible to retrieve the RFC 2822 (or any) headers from an email with the Outlook/Office 365 REST API? by doing

GET https://outlook.office.com/api/beta/me/mailfolders/inbox/messages$select=InternetMessageHeaders

But I can get the header only for inbox items, I need to retrieve the header for the sent items as well!

Upvotes: 1

Views: 1883

Answers (2)

Marcelo Gazzola
Marcelo Gazzola

Reputation: 1083

You can get it using the $value parameter to get the MIME type of the message and read the entire header!

From Example 4 - Get message

GET https://graph.microsoft.com/v1.0/me/messages/4aade2547798441eab5188a7a2436bc1/$value

Response

HTTP/1.1 200 OK
Content-type: text/plain

Received: from contoso.com (10.194.241.197) by 
contoso.com (10.194.241.197) with Microsoft 
SMTP Server (version=TLS1_2, 
cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1374.0 via Mailbox 
Transport; Mon, 4 Sep 2017 03:00:08 -0700 
Received: from contoso.com (10.194.241.197) by 
contoso.com (10.194.241.197) with Microsoft 
SMTP Server (version=TLS1_2, 
cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1374.0; Mon, 4 Sep 
2017 03:00:07 -0700 
Received: from contoso.com 
(fe80::5bf:5059:4ca0:5017) by contoso.com 
(fe80::5bf:5059:4ca0:5017%12) with mapi id 15.01.1374.000; Mon, 4 Sep 2017 
03:00:01 -0700 
From: Administrator <[email protected]> 
To: Administrator <[email protected]> 
Subject: This email has attachment. 
Thread-Topic: This email has attachment. 
Thread-Index: AQHTJWSHSywMzSz8o0OJud48nG50GQ== 
Date: Mon, 4 Sep 2017 10:00:00 +0000 
Message-ID: 
                <[email protected]> 
Accept-Language: en-US 
Content-Language: en-US 
X-MS-Exchange-Organization-AuthAs: Internal 
X-MS-Exchange-Organization-AuthMechanism: 04 
X-MS-Exchange-Organization-AuthSource: 
                contoso.com 
X-MS-Has-Attach: yes 
X-MS-Exchange-Organization-Network-Message-Id: 
                0ffdb402-ec03-42c8-5d32-08d4f37bb517 
X-MS-Exchange-Organization-SCL: -1 
X-MS-TNEF-Correlator: 
X-MS-Exchange-Organization-RecordReviewCfmType: 0 

MIME-Version: 1.0 

Upvotes: 1

Viet Nguyen
Viet Nguyen

Reputation: 59

The email headers are created by the email servers, these details can include who sent the message, the software that was used to compose it, and the email servers that it passed through on its way to the recipient. Hence you are not able to view the header information for the sent messages.

Upvotes: 0

Related Questions