microsoftgraph / microsoftgraph/msgraph-beta-sdk-dotnet
Events.Delta incorrectly requires a StartDateTime
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 112
- Forks
- 37
- Avg merge
- 14h 57m
- Merged PRs (30d)
- 3
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated Events.Delta DeltaRequestBuilder and the call in Clients/Graph/GraphClient.Event.cs:12, reproducing the request with and without StartDateTime. Trace how the optional parameter is represented and sent; done means event delta works in both cases as described by the API documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100