Reputation: 1063
I have created some extended properties on some events, but I am trying to return all events that don't contain this extended property.
Is it possible to build this filter somehow?
I am trying to pass these filtering clauses, but none seem to work:
1. singleValueExtendedProperties/any(ep: ep/id eq '{extendedPropertyId}' and ep/value eq '')
2. singleValueExtendedProperties/all(ep: ep/id ne '{extendedPropertyId}')
3. singleValueExtendedProperties/any(ep: ep/id eq '{extendedPropertyId}' and ep/value eq null)
Just to exemplify, I have 2 possible events:
In my query, I am trying to fetch only 2, excluding any extended property
UPDATE: I am running the following query in the /events endpoint, which works
https://graph.microsoft.com/v1.0/me/calendars/{calId}/events?startdatetime=2022-09-14T15:07:31.041Z&enddatetime=2022-09-23T15:07:31.042Z&$expand=singleValueExtendedProperties($filter=id eq 'String {43a36491-c91c-4480-b9c1-8fc61c6e0f6e} Name IntegrationId')&$filter=singleValueExtendedProperties/any(ep: ep/id eq 'String {43a36491-c91c-4480-b9c1-8fc61c6e0f6e} Name IntegrationId' and ep/value eq null)
But when running agains the /calendarView endpoint, it returns zero results
https://graph.microsoft.com/v1.0/me/calendars/{calId}}/calendarView?startdatetime=2022-09-14T15:07:31.041Z&enddatetime=2022-09-23T15:07:31.042Z&$expand=singleValueExtendedProperties($filter=id eq 'String {43a36491-c91c-4480-b9c1-8fc61c6e0f6e} Name IntegrationId')&$filter=singleValueExtendedProperties/any(ep: ep/id eq 'String {43a36491-c91c-4480-b9c1-8fc61c6e0f6e} Name IntegrationId' and ep/value eq null)
Upvotes: 0
Views: 325
Reputation: 22032
A pattern you can use is
singleValueExtendedProperties/any(ep: ep/id eq '{extendedPropertyId}' and ep/value eq null)
eg
https://graph.microsoft.com/v1.0/me/mailFolders('Inbox')/messages?$filter=singleValueExtendedProperties/any(ep: ep/id eq 'String 0x1042' and ep/value eq null)
If you want to use a Extended property within a Filter in a Calendar view then you need to expand it first (you don't need to do that when you are using the normal events endpoint). So something like
https://graph.microsoft.com/v1.0/me/calendar/calendarView?startDateTime=2022-09-01T19:00:00Z&endDateTime=2022-09-10T19:00:00Z&$select=subject&$expand=singleValueExtendedProperties($filter=id eq 'String 0x0037')&$filter=singleValueExtendedProperties/any(ep: ep/id eq 'String 0x0037' and ep/value eq 'Cloud and Mobile Working Group')
Upvotes: 1