Search code examples
microsoft-graph-apioutlook-restapi

Microsoft Graph -> Use the singleValueExtendedProperty in OData $select when expanded $expand


I'm able to fetch events from the users calendar with a Single Value Extended Property in it by using the correct $expand parameter.

https://graph.microsoft.com/v1.0/me/calendar/calendarview?startDateTime=2018-10-09&endDateTime=2019-01-09&$expand=singleValueExtendedProperties($filter=id eq 'String {cfe1492e-2c52-462d-8f0d-c1139326d46f} Name PropertyName')

This outputs the first 10 events with some that have this property filled (YEAY!!).

But how do I use the $select parameter in combination with this?

Because the above query would return all properties for those events while I'm only interested in the id, subject and singleValueProperties properties for all events. According to this page I should be able to only select the properties my application wants with the $select parameter but I have no clue how to use it with the singleValueProperty (or any other expanded properties).

I've tried the following list (in combination with the $expand to actually get the property included):

$select=id,subject,singleValueProperties (single value properties not included)
$select=id,subject,singleValueProperties.value (not included)
$select=id,subject,singleValueProperties/value (bad request)
$select=id,subject,singleValueProperties.* (not included)
$select=id,subject (not included)

Solution

  • This looks to be a Known Issue with Microsoft Graph. Under Query Parameters:

    • $expand:
      • No support for nextLink
      • No support for more than 1 level of expand
      • No support with extra parameters ($filter, $select)

    The wording here is a little odd, since $expand and $select certainly work together in other places. That said, I've been able to reproduce the same behavior and there clearly cases like this where $expand and $select do not.

    This is also documented in Use query parmeters:

    Note: Not all relationships and resources support the $expand query parameter. For example, you can expand the directReports, manager, and memberOf relationships on a user, but you cannot expand its events, messages, or photo relationships. Not all resources or relationships support using $select on expanded items.