Search code examples
restmicrosoft-graph-apiodata

GraphAPI read SingleValueExtendedProperties of a contact


Read and write a SingleValueExtendedProperty should be available for the contacts resource. However, the OData request does not include the SingleValueExtendedProperty within the JSON result.

You may verify my samples here.

  • Example 1: https://graph.microsoft.com/v1.0/me/contacts?$expand=singleValueExtendedProperties
  • Example 2: https://graph.microsoft.com/v1.0/me/contacts?$expand=singleValueExtendedProperties&$select=singleValueExtendedProperties
  • Example 3 (copy and paste from docs): https://graph.microsoft.com/v1.0/me/messages/{ID}?$expand=singleValueExtendedProperties

Besides the contacts resource enpoint not returning the singleValueExtendedProperties, also the messages endpoint returns nothing. I can't find anything on the MSDN page nor on GitHub. What am I missing here?


Solution

  • The way that singleValueExtendedProperties work in Exchange API's is that you need to specify every singleValueExtendedProperties property you want to be returned. They are not a normal collection that will just be returned and there is no way of returning all singleValueExtendedProperties on an item (outside of specifying each property) and they will also only be returned if the property actually exists on the item so if you request an property that doesn't exist on a contact you won't get anything in the response eg the simplest request

    https://graph.microsoft.com/v1.0/me/contacts?$expand=singleValueExtendedProperties($filter=id eq 'String 0x0037')
    

    or if you want multiple properties then you need to do

    https://graph.microsoft.com/v1.0/me/contacts?$expand=singleValueExtendedProperties($filter=(id eq 'String 0x0037') OR (id eq 'String 0x3A06'))