Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Outlook REST API item id to MAPI EntryID

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

like image 677
SvenC Avatar asked Feb 14 '17 07:02

SvenC


1 Answers

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.

like image 122
dillonius01 Avatar answered Nov 06 '22 22:11

dillonius01