Can you get PR_TRANSPORT_MESSAGE_HEADERS 0x007D from the .Net Microsoft Graph API?

旧时模样 提交于 2020-06-29 04:16:33

问题


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'.


回答1:


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;


来源:https://stackoverflow.com/questions/48335248/can-you-get-pr-transport-message-headers-0x007d-from-the-net-microsoft-graph-ap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!