Filtering calendar view by open extensions or single value extended properties results in a 500 internal server error response
Describe the bug
If I try to filter calendar view by the extensions or singleValueExtendedProperties collections, I get an error response with code ErrorInternalServerError and message An internal server error occurred. The operation failed..
To Reproduce Steps to reproduce the behavior:
- Write the following query using a Graph service client:
await graphServiceClient.Me.Calendars[microsoftGraphCalendarId].CalendarView.GetAsync(configuration =>
{
configuration.QueryParameters.StartDateTime = startDateUtc.ToString("O", CultureInfo.InvariantCulture);
configuration.QueryParameters.EndDateTime = endDateUtc.ToString("O", CultureInfo.InvariantCulture);
configuration.QueryParameters.Filter = $"extensions/any(e: e/id eq 'Some.Random.Id')";
// Alternatively, $"singleValueExtendedProperties/any(ep: ep/id eq 'String {GUID} Name SomeName' and ep/value ne null)";
}).ConfigureAwait(false);
- Run it.
- Get the internal server error.
Expected behavior
The query should not throw an internal server error. This works if you write this query manually in the Graph Explorer, for example https://graph.microsoft.com/v1.0/me/calendars/{your-calendar-id}/calendarView?startDateTime=2023-03-10T13%3A28%3A00.3401552Z&endDateTime=2025-03-10T13%3A28%3A00.3455699Z&$filter=extensions/any(e: e/id eq 'Some.Random.Id').
Inspecting what the Graph service client tries to query shows that it encodes it as
https://graph.microsoft.com/v1.0/me/calendars/{your-calendar-id}/calendarView?startDateTime=2023-03-10T13%3A28%3A00.3401552Z&endDateTime=2025-03-10T13%3A28%3A00.3455699Z&$filter=extensions%2Fany%28e%3A e%2Fid eq %27Some.Random.Id%27%29. This results in the exact same internal server error if put into the Graph Explorer.
As a result, I imagine the Graph service client is somehow encoding the URI in an unsupported way.
Looking at how the Graph Explorer encodes it, it makes a request to the following:
https://graph.microsoft.com/v1.0/me/calendars/{your-calendar-id}/calendarView?startDateTime=2023-03-10T13%3A28%3A00.3401552Z&endDateTime=2025-03-10T13%3A28%3A00.3455699Z&$filter=extensions/any(e:%20e/id%20eq%20%27Some.Random.Id%27).
Unless I'm missing something, the only difference is that the Graph Explorer actually encodes the spaces, whereas the Graph service client does not.
Notably, doing this same filter with raw events rather than calendar view works with the Graph service client. For example, the C# query I wrote but modified to query events results in the Graph service client producing the following URI:
https://graph.microsoft.com/v1.0/me/calendars/{your-calendar-id}/events?$filter=extensions%2Fany%28e%3A%20e%2Fid%20eq%20%27Some.Random.Id%27%29. Notice that the spaces are encoded here.
I suspect something about the way the calendar view query URI is built results in spaces not being URL encoded, and that this is the cause of the internal server error.
Coming back to this, I haven't been able to reproduce the ability to run this query in the Graph Explorer. Trying to filter calendarView by open extensions and extended properties causing an internal server error may just be a limitation of the Graph API.
Thanks for confirming this on the Graph Explorer @NetherGranite
You could always create a feature request for the API owners at the link below so that support for this scenario could be looked into. It would be great if you posted a link back here as a comment so anyone who comes accross this could upvote it.
https://feedbackportal.microsoft.com/feedback/forum/ebe2edae-97d1-ec11-a7b5-0022481f3c80
This feature request can be found here: https://feedbackportal.microsoft.com/feedback/idea/a11c295b-68ff-ee11-a73d-6045bd841c15