'Need to create VSTO UserProperties with MS Graph

We have an add in that works with user properties set as Outlook.OlUserPropertyType.olInteger I have been asked to integrate that with MSGraph.

According to this post if user properties are created in a VSTO add in this can be accessed through MS Graph but how can I go the other way? I need to use Outlook extended properties but I am not sure how

So far I am not sure how to add extended properties and how to pick them up in a VSTO add in



Solution 1:[1]

You need to use the GUID for dealing with user properties. See How do I retrieve Extended Properties from a Calendar Event using MS Graph? for more information. For example:

https://graph.microsoft.com/v1.0/me/events('AAMkADU4MzkxN2RmLTdiZDAtNDIwYS04NjQzLTUzNzMyMjM0Y2VkNQBGAAAAAABGjw0ByCaySL6aUxJmew3qBwDwiT27qO5xT6RMWiWBhwRzAAAADIqqAAAYpSJ8f1CATrNsRrtUbquzAAEOAONsAAA=')?$expand=singleValueExtendedProperties($filter=id%20eq%20'String%20{00020329-0000-0000-C000-000000000046}%20Name%20MyCustomData')

A user property set via MS Graph API

Solution 2:[2]

User properties are twofold: their definition is stored in a special blob (you can see its definition in MFCMAPI or OutlookSpy (I am its author) - click IMessage button) and their value is stored as a regular named MAPI property (see the OutlookSpy screenshot in Eugene's answer). The blob format is documented, but parsing or (even worse) creating it is a major pain. If you don't need the property to be present in the MailItem.UserProperties collection, you can read or set its value using MailItem.PropertyAccessor.GetProperty/SetProperty by the property DSL name (also shown by OutlookSpy). To read or set the value using Graph, you can use the link in your question.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eugene Astafiev
Solution 2