msgraph-beta-sdk-dotnet icon indicating copy to clipboard operation
msgraph-beta-sdk-dotnet copied to clipboard

Events.Delta incorrectly requires a StartDateTime

Open salihkilic opened this issue 6 months ago • 0 comments

Describe the bug

Calling _graphClient.Users[userId].Calendars[calendarId].Events.Delta.GetAsDeltaGetResponseAsync() without any query parameters results in an ODataError with the following value: The value '' of parameter 'StartDateTime' is invalid.

Calling the same method like this does not result in an exception:

var response = await _graphClient.Users[userId].Calendars[calendarId].Events.Delta.GetAsDeltaGetResponseAsync(config =>
        {
            config.QueryParameters.StartDateTime = DateTimeOffset.MinValue.ToString();
        });

Expected behavior

The API documentation for Events says the following on startDateTime:

Optional for delta on events in a calendar. Required for delta on calendarView.

The expected behaviour is that _graphClient.Users[userId].Calendars[calendarId].Events.Delta.GetAsDeltaGetResponseAsync() works with and without the StartDateTime query parameter, following the documentation of the API.

How to reproduce

This will return an error:

var response = await _graphClient.Users[userId].Calendars[calendarId].Events.Delta.GetAsDeltaGetResponseAsync(config =>
        {
            // Uncomment to solve the error
            // config.QueryParameters.StartDateTime = DateTimeOffset.MinValue.ToString();
        });

SDK Version

5.110.0-preview

Latest version known to work for scenario above?

No response

Known Workarounds

Like said above, as long as you do give a startDateTime, you won't get the error.

Debug output

Click to expand log ``` Microsoft.Graph.Beta.Models.ODataErrors.ODataError: The value '' of parameter 'StartDateTime' is invalid. at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.ThrowIfFailedResponseAsync(HttpResponseMessage response, Dictionary`2 errorMapping, Activity activityForAttributes, CancellationToken cancellationToken) at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory`1 factory, Dictionary`2 errorMapping, CancellationToken cancellationToken) at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory`1 factory, Dictionary`2 errorMapping, CancellationToken cancellationToken) at Microsoft.Graph.Beta.Users.Item.Calendars.Item.Events.Delta.DeltaRequestBuilder.GetAsDeltaGetResponseAsync(Action`1 requestConfiguration, CancellationToken cancellationToken) at Calendar.Remote.Clients.Graph.GraphClient.GetInitialEventDelta[TSelect](String userId, String calendarId) in D:\Repos\GraphPrototype\GraphClientWrapper\Clients\Graph\GraphClient.Event.cs:line 12 at Calendar.Remote.Services.CalendarService.GetInitialEventDelta(String emailAddress, String calendarId) in D:\Repos\GraphPrototype\GraphClientWrapper\Services\CalendarService.cs:line 21 at CalendarDemo.Program.Main(String[] args) in D:\Repos\GraphPrototype\CalendarDemo\Program.cs:line 47 at CalendarDemo.Program.
(String[] args) ```

Configuration

  • Windows 11
  • x64
  • IDE: Jetbrains Rider

Other information

For some reason it doesn't seem to happen for the endDate. I looked into the DeltaRequestBuilder but I find myself a little too junior to navigate through the generated code.

salihkilic avatar Jun 05 '25 13:06 salihkilic