-
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
Serialization Issues for Null values of Graph Event Objects #2607
Comments
Thanks for raising this @visnikam As the models are generated by Kiota, the you would need to use the serialization helpers to serializer the models. Any chance you can confirm if this works for you? https://learn.microsoft.com/en-us/openapi/kiota/serialization?tabs=csharp#serialization-helpers |
@andrueastman Could you please help us to understand where exactly model should be serialization as we pass Event object to SDK Patch method URL : https://graph.microsoft.com/v1.0/users/{useremail}/events/{eventId} var eGraphUpdatedResponse = await graphClient.Users[delegatedUserEmail].Events[eCreated.Id] |
Any chance you can confirm if the json for the payload is as you expect when you you obtain the json string from the payload as var jsonString = await KiotaJsonSerializer.SerializeAsStringAsync(updateEvent ); |
@andrueastman yes, I shared sample request. we can't serialize the event like below as string. SDK patch method required event as object and not string Sterilization happens at SDK level. Please suggest, if there is SDK configuration setting for KiotaJsonSerializer var jsonString = await KiotaJsonSerializer.SerializeAsStringAsync(updateEvent ); Code Sample : var eGraphUpdatedResponse = await graphClient.Users[delegatedUserEmail].Events[eCreated.Id] |
Apologies for not being clearer earlier, but could you share the value of the var jsonString = await KiotaJsonSerializer.SerializeAsStringAsync(updateEvent ); |
@andrueastman Please find below jsonString value of Event object with KiotaJsonSerializer {
"contentType": "html" }, "isReminderOn": true, "reminderMinutesBeforeStart": 507 } |
Thanks for confirming this @visnikam It looks like the To confirm, do you mean existing attendees are removed from the list when the response comes back? |
@andrueastman Yes, attendees property is present here in the payload. We do get success as response from the SDK/Graph API but sometimes attendees are null/empty in the response and in that case attendee doesn't get the invite update. Microsoft team told us that it's due to additional properties in payload passed by SDK. Please suggest |
Are you able to share a sample of the additional properties that are passed? Any chance you've taken a look at the guidance at https://learn.microsoft.com/en-us/graph/api/event-update?view=graph-rest-1.0&tabs=http#notes-for-updating-specific-properties |
I stumbled across this -- it is also happening to our project as well. Same SDK version -- passing up Attendees at time of creation of the Event -- makes the list null when it's created - no Attendees. |
@andrueastman They asked us not to use SDK and call Graph API call directly with sample payload like {
"contentType": "html" }, "isReminderOn": true, "reminderMinutesBeforeStart": 507 } |
@visnikam do you get a different result? The payload looks the same to the one shared earlier... |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
Describe the bug
We have observed a serialization issue when using from Microsoft.Graph version 5.56.0 in our .NET 6 project. In Update event, patch method it adds Null values to priorities that or not assigned. we've noticed that some fields are missing in the response from event patch call e.g. attendees. We have used System.Text.Json for sterilization and also tried JsonIgnoreCondition but it didn't work while passing event object to SDK method. Microsoft Graph API team mentioned that failure or issues due to additional properties in patch request. Please suggest.
JsonSerializerOptions options = new()
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};
URL : https://graph.microsoft.com/v1.0/users/{useremail}/events/{eventId}
Http Method : Patch
SDK Method : graphClient.Users[delegatedUserEmail].Events[eCreated.Id].PatchAsync(updateEvent);
UpdateEvent Request Object:
{
"AllowNewTimeProposals": null,
"Attachments": null,
"Attendees": [
{
"ProposedNewTime": null,
"Status": null,
"Type": 0,
"AdditionalData": {},
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": false
},
"EmailAddress": {
"AdditionalData": {},
"Address": "abc@test.com",
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": false
},
"Name": null,
"OdataType": null
},
"OdataType": "#microsoft.graph.attendee"
},
{
"ProposedNewTime": null,
"Status": null,
"Type": 0,
"AdditionalData": {},
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": false
},
"EmailAddress": {
"AdditionalData": {},
"Address": "xyz@test.com",
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": false
},
"Name": null,
"OdataType": null
},
"OdataType": "#microsoft.graph.attendee"
}
],
"Body": {
"AdditionalData": {},
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": true
},
"Content": "
"ContentType": 1,
"OdataType": null
},
"BodyPreview": null,
"Calendar": null,
"End": null,
"Extensions": null,
"HasAttachments": null,
"HideAttendees": null,
"ICalUId": null,
"Importance": null,
"Instances": null,
"IsAllDay": null,
"IsCancelled": null,
"IsDraft": null,
"IsOnlineMeeting": null,
"IsOrganizer": null,
"IsReminderOn": true,
"Location": null,
"Locations": null,
"MultiValueExtendedProperties": null,
"OnlineMeeting": null,
"OnlineMeetingProvider": null,
"OnlineMeetingUrl": null,
"Organizer": null,
"OriginalEndTimeZone": null,
"OriginalStart": null,
"OriginalStartTimeZone": null,
"Recurrence": null,
"ReminderMinutesBeforeStart": 1532,
"ResponseRequested": null,
"ResponseStatus": null,
"Sensitivity": null,
"SeriesMasterId": null,
"ShowAs": null,
"SingleValueExtendedProperties": null,
"Start": null,
"Subject": null,
"TransactionId": null,
"Type": null,
"WebLink": null,
"Categories": null,
"ChangeKey": null,
"CreatedDateTime": null,
"LastModifiedDateTime": null,
"AdditionalData": {},
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": true
},
"Id": null,
"OdataType": "#microsoft.graph.event"
}
Expected behavior
Update Event Request Object for Patch call expected below
{
"Attendees": [
{
"ProposedNewTime": null,
"Status": null,
"Type": 0,
"AdditionalData": {},
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": false
},
"EmailAddress": {
"AdditionalData": {},
"Address": "abc@test.com",
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": false
},
"Name": null,
"OdataType": null
},
"OdataType": "#microsoft.graph.attendee"
},
{
"ProposedNewTime": null,
"Status": null,
"Type": 0,
"AdditionalData": {},
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": false
},
"EmailAddress": {
"AdditionalData": {},
"Address": "xyz@test.com",
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": false
},
"Name": null,
"OdataType": null
},
"OdataType": "#microsoft.graph.attendee"
}
],
"Body": {
"AdditionalData": {},
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": true
},
"Content": "
"ContentType": 1,
"OdataType": null
}
}
How to reproduce
URL : https://graph.microsoft.com/v1.0/users/{useremail}/events/{eventId}
Http Method : Patch
SDK Method : SDK Method : graphClient.Users[delegatedUserEmail].Events[eCreated.Id].PatchAsync(updateEvent);
UpdateEvent Request Object :
{
"AllowNewTimeProposals": null,
"Attachments": null,
"Attendees": [
{
"ProposedNewTime": null,
"Status": null,
"Type": 0,
"AdditionalData": {},
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": false
},
"EmailAddress": {
"AdditionalData": {},
"Address": "abc@test.com",
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": false
},
"Name": null,
"OdataType": null
},
"OdataType": "#microsoft.graph.attendee"
},
{
"ProposedNewTime": null,
"Status": null,
"Type": 0,
"AdditionalData": {},
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": false
},
"EmailAddress": {
"AdditionalData": {},
"Address": "xyz@test.com",
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": false
},
"Name": null,
"OdataType": null
},
"OdataType": "#microsoft.graph.attendee"
}
],
"Body": {
"AdditionalData": {},
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": true
},
"Content": "
"ContentType": 1,
"OdataType": null
},
"BodyPreview": null,
"Calendar": null,
"End": null,
"Extensions": null,
"HasAttachments": null,
"HideAttendees": null,
"ICalUId": null,
"Importance": null,
"Instances": null,
"IsAllDay": null,
"IsCancelled": null,
"IsDraft": null,
"IsOnlineMeeting": null,
"IsOrganizer": null,
"IsReminderOn": true,
"Location": null,
"Locations": null,
"MultiValueExtendedProperties": null,
"OnlineMeeting": null,
"OnlineMeetingProvider": null,
"OnlineMeetingUrl": null,
"Organizer": null,
"OriginalEndTimeZone": null,
"OriginalStart": null,
"OriginalStartTimeZone": null,
"Recurrence": null,
"ReminderMinutesBeforeStart": 1532,
"ResponseRequested": null,
"ResponseStatus": null,
"Sensitivity": null,
"SeriesMasterId": null,
"ShowAs": null,
"SingleValueExtendedProperties": null,
"Start": null,
"Subject": null,
"TransactionId": null,
"Type": null,
"WebLink": null,
"Categories": null,
"ChangeKey": null,
"CreatedDateTime": null,
"LastModifiedDateTime": null,
"AdditionalData": {},
"BackingStore": {
"ReturnOnlyChangedValues": false,
"InitializationCompleted": true
},
"Id": null,
"OdataType": "#microsoft.graph.event"
}
SDK Version
5.56.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```The text was updated successfully, but these errors were encountered: