Convert Outlook REST API item id to MAPI EntryID

2019-04-13 17:40发布

is there an officially supported way to convert item ids from the Outlook REST API into an MAPI EntryID?

I am talking about the "Id" field returned for items in the json response of an http GET on a mailbox endpoint like so:

https://outlook.office365.com/api/v2.0/me/messages

The Id field contains a base64 value. When I convert it to hex and compare it to the PR_ENTRY_ID value of the same item, e.g. with MFCMAPI, I can find the EntryID is contained in the hex version of the Id field.

Is there an official documentation how to convert between the id formats?

Or an API to call? Would prefer a local convert functions to avoid additional REST roundtrips.

Thanks for any hints SvenC

2条回答
放我归山
2楼-- · 2019-04-13 18:21

is there an officially supported way to convert item ids from the Outlook REST API into an MAPI EntryID?

No, office.js API doesn't have anything to convert REST/EWS Id to PR_ENTRY_ID

Is there an official documentation how to convert between the id formats?

Obviously there is no documentation as of point above

Or an API to call? Would prefer a local convert functions to avoid additional REST roundtrips.

Yes, there are calls to retrieve (not convert) IMessage Id and this is exactly what you've done ... RESTful or EWS requests. With those requests you are able to get IMessage properties, including PR_ENTRY_ID. I just don't really understand what you are going to use it for? Any requests back to the message have to be done with EWS/REST Id anyway. Well, probably this is something to do with your message manipulation.

查看更多
乱世女痞
3楼-- · 2019-04-13 18:31

Your query to the Microsoft Graph API can specify that you would like to include the PR_ENTRYID or other MAPI properties. Here is the official documentation for singleValueLegacyExtendedProperty from Microsoft.

For example, if you wanted to fetch a page of your messages and include the PR_ENTRYID, you could make a GET request to:

https://graph.microsoft.com/v1.0/me/messages?$expand=singleValueExtendedProperties($filter=id%20eq%20'Binary%200x0FFF')

Without URL encoding, the $expand statement reads: $expand=singleValueExtendedProperties($filter=id eq 'Binary 0x0FFF')

There are three valid syntaxes to filter for MAPI properties:

  1. 'MapiPropertyType namespaceGuid Name propertyName'
  2. 'MapiPropertyType namespaceGuid Id propertyId'
  3. 'MapiPropertyType propertyTag'

Note that the example above uses #3, and that 0x0FFF is the propertyTag for PR_ENTRYID per the [MS-OXPROPS] Exchange Server Protocols Master Property List.

查看更多
登录 后发表回答