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

Heiko 1 Reputation point
2021-10-21T12:50:03.983+00:00

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://learn.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
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,592 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Danstan Onyango 3,741 Reputation points Microsoft Employee
    2021-10-25T09:00:51.863+00:00

    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\""  
        }  
    ]  
    
    0 comments No comments