2

We are using alias email addresses to match incoming emails with a client. All the alias addresses are delivered into one Primary emailbox.

The alias address is not listed in the ToRecipients. If I open the email in OWA and look at the message details, I can see the alias in the To: property of the message header.

I tried using the graph.microsoft.com/beta endpoint to get the internetMessageHeader. It worked great(I was surprised.) Unfortunately, the To: property is missing from the response. (The From: property is missing too.)

The problem is the same as this question about using EWS. Exchange Web Services (EWS) API "To" header for alias

Is there an equivalent way to get the PR_TRANSPORT_MESSAGE_HEADERS 0x007D property using the Microsoft-Graph API .Net?

I tried:

var myvar = await graphClient.Users[inbox].Messages[message.Id].Request().Select("transportMessageHeaders").GetAsync();

But I got this error: Message: Could not find a property named 'transportMessageHeaders' on type 'Microsoft.OutlookServices.Message'.

Laurie996
  • 113
  • 1
  • 8

1 Answers1

5

Yes, you can access MAPI properties as extended properties in the Microsoft Graph API.

The URL construct you'd want would look something like:

GET /me/messages/{message-id}?$expand=singleValueExtendedProperties(
    $filter=id eq 'String 0x007D')

Since you're using the .NET Graph library, you would modify your code above like so:

var myvar = await graphClient.Users["user"]
    .Messages[message.Id]
    .Request().Select("singleValueExtendedProperties")
    .Expand("singleValueExtendedProperties($filter=id eq 'String 0x007D')").GetAsync();

string transportHeaders = myVar.SingleValueExtendedProperties.First().Value;
Jason Johnston
  • 17,194
  • 2
  • 20
  • 34