Calendarview call in c# not working with msgraph-sdk-dotnet / visual studio

Dirk Oppenländer 0 Reputation points


since calling the eventlist does not return reoccuring events from event series i am trying to get the calendarview with the new syntax requestConfiguration.QueryParameters.Filter.

in lack of Documentation i am not able to get it to work - instead i geet an ODataError exception.

My Syntax (which worked fine for events) for the Calendarview ist as follows:

Please give me a hint what i am missing....

 calendarEvents = await graphServiceClient
        .GetAsync(requestConfiguration =>
            requestConfiguration.QueryParameters.Filter = "start/dateTime ge '2023-03-02T00:00:00.0000000Z' and end/dateTime le '2023-03-03T23:59:00.0000000Z'";
Microsoft Graph Calendar API
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shivam Dhiman-MSFT 5,446 Reputation points Microsoft Vendor

    Hi @Dirk Oppenländer

    As per the documentation you can use this C# Graph SDK.

    var graphClient = new GraphServiceClient(requestAdapter);
    var result = await graphClient.Users["{user-id}"].CalendarView.GetAsync((requestConfiguration) =>
        requestConfiguration.QueryParameters.StartDateTime = "2023-02-01T19:00:00-08:00";
        requestConfiguration.QueryParameters.EndDateTime = "2023-03-02T19:00:00-08:00";

    Instead of using ge/le use '=' and pass date range as start and end. This will give all the events in start and end range and no need to use filter while passing start and end date.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.