The mail message does not contains header information

Copper Contributor

I am using the below endpoint to read mail messages from a given mail folder but I see the message does not contain header information.
Endpoint- https://graph.microsoft.com/v1.0/me/mailFolders/{folderid}messages/?$orderby=sentDateTime
{ "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('55f7b855-44a8-46c2-908a-00ff4d54c46e')/mailFolders...", "value": [ { "@odata.etag": "W/\"CQAAABYAAABS/93vVKPQSplCgJiEpZiAAAAMRZRE\"", "id": "AAMkAGYyOTI1Yzc5LTFlZjctNDlhYy1hMWQzLTA1MjY0ZmRkMGRlMABGAAAAAAD-3pfl37V2SrdGHTzfvdd7BwBS-93vVKPQSplCgJiEpZiAAAAAAAEJAABS-93vVKPQSplCgJiEpZiAAAAMTZWmAAA=", "createdDateTime": "2021-08-02T12:47:39Z", "lastModifiedDateTime": "2021-08-02T12:47:42Z", "changeKey": "CQAAABYAAABS/93vVKPQSplCgJiEpZiAAAAMRZRE", "categories": [], "receivedDateTime": "2021-08-02T12:47:40Z", "sentDateTime": "2021-08-02T12:47:39Z", "hasAttachments": false, "internetMessageId": "<MAZPR01MB5442E2218F9D377BD1D514E4E9EF9@MAZPR01MB5442.INDPRD01.PROD.OUTLOOK.COM>", "subject": "rr", "bodyPreview": "rr", "importance": "normal", "parentFolderId": "AQMkAGYyOTI1Yzc5LTFlZjctNDlhYy1hMWQzLTA1MjY0ZmRkADBkZTAALgAAA--el_XftXZKt0YdPN_913sBAFL-3e9Uo9BKmUKAmISlmIAAAAIBCQAAAA==", "conversationId": "AAQkAGYyOTI1Yzc5LTFlZjctNDlhYy1hMWQzLTA1MjY0ZmRkMGRlMAAQAKmsc6svyzlHuJr_l4TQwX4=", "conversationIndex": "AQHXh5yTqaxzqy/LOUe4mv6XhNDBfg==", "isDeliveryReceiptRequested": false, "isReadReceiptRequested": false, "isRead": true, "isDraft": false, "webLink": "https://outlook.office365.com/owa/?ItemID=AAMkAGYyOTI1Yzc5LTFlZjctNDlhYy1hMWQzLTA1MjY0ZmRkMGRlMABGAA...", "inferenceClassification": "focused", "body": { "contentType": "html", "content": "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><meta content=\"text/html; charset=iso-8859-1\"><style type=\"text/css\" style=\"display:none\"><!--p{margin-top:0;margin-bottom:0}--></style></head><body dir=\"ltr\"><div style=\"font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)\">rr<br></div></body></html>" }, "sender": { "emailAddress": { "name": "some name", "address": "some address" } }, "from": { "emailAddress": { "name": "some name", "address": "some address" } }, "toRecipients": [ { "emailAddress": { "name": "some name", "address": "some address" } } ], "ccRecipients": [], "bccRecipients": [], "replyTo": [], "flag": { "flagStatus": "notFlagged" } } ] }

When using java mail API to read the same messages I could able to retrieve the headers information as-
#java_mail
javax.mail.Message message= some object;

Enumeration headers = message.getAllHeaders();

There is no clarity in documentation regarding this.

I see some places to use below in Graph API
com.microsoft.graph.models.Message message = some msg obj;
List headers = message.internetMessageHeaders;
but there is no internetMessageHeaders value in response.

It is strange for me that when reading via javax.mail.Message i can retrieve headers but not via MS Graph API com.microsoft.graph.models.Message.

Is there any way to achieve this using an MS graph API?

0 Replies