question

Heiko-0786 avatar image
0 Votes"
Heiko-0786 asked Danstan-MSFT answered

How to get extended property PidTagSentMailEntryId in Message via Microsoft Graph API?

0


I'm using Microsoft Graph API to get my Office365 emails via /me/messages. I try to fetch the attribute for if it is sent or received.

Some other members noticed me about this extended property: https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagsentmailentryid-canonical-property

So I tried to GET it via: https://graph.microsoft.com/v1.0/me/messages?$select=ReceivedDateTime,Sender,Subject,IsRead,parentFolderId,&$expand=SingleValueExtendedProperties($filter=(Id eq 'Binary 0x0E0A'))

But unfortunately, I don't know how to access the extended property now. It is not visible within the Message object itself. If I dump a sent mail, the object looks like all other message objects and I can't find any more informations as without the $expand parameter.

What I'm doing wrong here? How can I access the PidTagSentMailEntryId property?

microsoft-graph-sdk
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Which SDK are you using? c#?

0 Votes 0 ·

1 Answer

Danstan-MSFT avatar image
0 Votes"
Danstan-MSFT answered

When you run the query, the value will be expanded in the property singleValueExtendedProperties as below.

143403-message-single-value-extended-props.png

If you are using the SDK assuming you are using .Net SDK for example, you can do

  var messages = await graphServiceClient
             .Users["user-id"]
             .Messages
             .Request()
             .Select("id,subject")
             .Expand("SingleValueExtendedProperties($filter=(Id eq 'Binary 0x0E0A'))")
             .GetAsync();

This will return data that looks like:

 [
     {
         "subject": "Subject goes here.",
         "singleValueExtendedProperties": [
             {
                 "value": "AAAAAMEqF24GH9hBjk0AEaj0EDABABWeiu9p+xxMo+DU7D1wckAAAAAAAQkAAA==",
                 "id": "Binary 0xe0a",
                 "@odata.type": null
             }
         ],
         "id": "AAMkAG...Vr9AAA=",
         "@odata.type": "microsoft.graph.message",
         "@odata.etag": "W/\"CQAAABYAAAAVnorvafscTKPg1Ow9cHJAAACpk/SK\""
     },
     {
         "subject": "Major update from Message center",
         "id": "AAMkAG...vAAA=",
         "@odata.type": "microsoft.graph.message",
         "@odata.etag": "W/\"CQAAABYAAAAVnorvafscTKPg1Ow9cHJAAACpk96l\""
     }
 ]







5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.