microsoftgraph / microsoftgraph/msgraph-sdk-dotnet
Unable to create Subscriptions using GraphServiceClient
@shemogumbe is already working on this.
Since Sep 23, 2024.
- Dominant language
- C#
- Stars
- 789
- Forks
- 264
- Avg merge
- 15h 17m
- Merged PRs (30d)
- 3
Description
Describe the bug
When using the client library (v5.36.0) and serializing the ExpirationDateTime property of Subscription class the result in value which is not accepted by the endpoint. The response error message indicates that expiration date is not provided at all: 400 expirationDateTime is a required property for subscription creation.
To Reproduce
Steps to reproduce the behavior:
- Create C# project and instanciate new GraphServiceClient
- Instanciate new Subscription object and provide valid value for ExpirationDateTime (e.g.
DateTimeOffset.UtcNow.AddMinutes(60)) - Call
graphClient.Subscriptions.PostAsync(subscription)method - Error response is returned
Expected behavior
New subscription is created succesfully.
Screenshots
Using logger handler I can see the payload generated by the library:
Desktop (please complete the following information):
- OS: Win11
- Browser Edge
- Version 120.0.2210.91
Additional context
Leaving the ExpirationDateTime property unset (null) result into the same error message. Same request is issued using a postman - expectedly the same error occur. However, ammending the postman payload from 2023-12-28T18:23:45.9356913+00.00 to 2023-12-28T18:23:45.9356913Z is now accepted by the endpoint and processed as expected. Same behavior is observed when renewing subscription.
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.
Assessment
This issue has not been assessed yet.