Convert Outlook REST API item id to MAPI EntryID

大兔子大兔子 提交于 2019-12-21 20:15:26

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/42220623/convert-outlook-rest-api-item-id-to-mapi-entryid

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