-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event JSON payload cannot be deserialized by Microsoft Graph #1890
Comments
Thanks for raising this @dkonyayev, Any chance you can share the method used to serialize the models in this case? The graph client library should handle serialization /deserialization and successful requests made as documented at the link below. |
@andrueastman So a very simple example is serialization of "odatatype" property. It used to seralize as property name "@odata.type" in v4, and in v5 it seralizes as "odatatype". Microsoft Graph does not recognize "odatatype" property, and it expects "@odata.type". I tested it by manually renaming properties to get the payload to process. Our code looks like this
|
We'll close this for now. With the latest version of the Microsoft.Graph.Core, you should also be able to use the serialization helper methods available from Kiota abstractions. https://www.nuget.org/packages/Microsoft.Graph.Core/3.1.1 var serializedString = KiotaJsonSerializer.SerializeAsString(date); |
Describe the bug
We have been using Microsoft.Graph nuget package version 4.X to create a JSON event payload to use with REST POST API call to Microsoft Graph. After we upgraded to version 5.X, the payload is no longer accepted by the graph service.
Specifically, some of the JSON attributes were removed from the models. In the example below, the version 5
"OdataType": "#microsoft.graph.attendee"
used to be
"@odata.type": "microsoft.graph.attendee"
{
"Attendees": [
{
"Type": 0,
"AdditionalData": {},
"BackingStore": {
"InitializationCompleted": true,
"ReturnOnlyChangedValues": false
},
"EmailAddress": {
"AdditionalData": {},
"Address": "dkonyayev@metlife-qa.com",
"BackingStore": {
"InitializationCompleted": true,
"ReturnOnlyChangedValues": false
}
},
"OdataType": "#microsoft.graph.attendee"
}
],
"Body": {
"AdditionalData": {},
"BackingStore": {
"InitializationCompleted": true,
"ReturnOnlyChangedValues": false
},
"Content": "Paid Time Off - 12345",
"ContentType": 0
},
"BodyPreview": "Microsoft.Graph.Models.ItemBody",
"End": {
"AdditionalData": {},
"BackingStore": {
"InitializationCompleted": true,
"ReturnOnlyChangedValues": false
},
"DateTime": "5/11/2023 12:00:00 AM",
"TimeZone": "Eastern Standard Time"
},
"IsAllDay": true,
"IsReminderOn": false,
"Locations": [
{
"AdditionalData": {},
"BackingStore": {
"InitializationCompleted": true,
"ReturnOnlyChangedValues": false
},
"DisplayName": "12345"
}
],
"ResponseRequested": false,
"ShowAs": 4,
"Start": {
"AdditionalData": {},
"BackingStore": {
"InitializationCompleted": true,
"ReturnOnlyChangedValues": false
},
"DateTime": "5/10/2023 12:00:00 AM",
"TimeZone": "Eastern Standard Time"
},
"Subject": "Konyayev, Dmitriy: Paid Time Off",
"AdditionalData": {},
"BackingStore": {
"InitializationCompleted": true,
"ReturnOnlyChangedValues": false
},
"OdataType": "#microsoft.graph.event"
}
To Reproduce
Create JSON payload from Event and POST to Microsoft Graph to create calendar event.
Expected behavior
We expect the Event payload generated by version 5+ of nuget package to be consumable by Microsoft Graph service.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: