0

I'm exporting app specific events to MS Calendar. To distinguish them from others (for later updating/removing by the app) I set an extended property for them (with SingleValueExtendedProperties).

I found out how to filter events by the presence (and value) of this extended property (Get events that have an custom property set by an add-in e.g.)

I also found out how to ask for the value of this property by $expand-ing particular event id - https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/singlevaluelegacyextendedproperty_get

What I can't find is how to get a list of matched events and this extended property for every item. For all the examples I checked (under the second link there're many) it is stated that The response does not include the matching extended property. Why so and how then? Obviously, it would be not very performant to get $filter-ed list and then $expand every item with the separate requests...

I would be very appreciated for any help/hints/thoughts.

2 Answers2

0

According to your description, I assume you want to list the event and extend the property of every item.

We can refer to this document. This document say that,

Using the query parameter $expand allows you to get the specified resource instance expanded with a specific extended property. Use a $filter and eq operator on the id property to specify the extended property. This is currently the only way to get the singleValueLegacyExtendedProperty object that represents an extended property.

We can submit this feature request on the User Voice

Keen Jin
  • 1,060
  • 1
  • 6
  • 8
0

I found the solution. It could be done with "open extension":

https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/opentypeextension_post_opentypeextension

The workflow is following:

  1. fill extensions field when creating/updating event:

    subject: 'my event',
    ... 
    extensions: [{
      '@odata.type': 'Microsoft.Graph.OpenTypeExtension',
      extensionName: MS_EXTENSION_ID,
      appSpecificId: myId
    }]
    
  2. then use a query like this to filter and expand "open extension" values:

    url: 'https://graph.microsoft.com/v1.0/me/events'
      + '?$select=subject,start,end'
      + '&$filter=Extensions/any(f:f/id eq \'' + MS_EXTENSION_ID + '\')'
      + '&$expand=Extensions($filter=id eq \'' + MS_EXTENSION_ID + '\')',
    

MS_EXTENSION_ID could be just a reverse domain name, like Biz.MyCompany.Events

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459