-
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
User Patch request fails if 'displayName' is not present #2561
Comments
Thanks for raising this @bolt-io. As this is an issue related to the functionality of the API and this repo is mainly intended for SDK related issues, any chance you can post the question at the link below to get feedback from the relevant API owners? |
@andrueastman it would look to me like the issue is somewhere in the SDK as running directly against the Graph API results in a success response (see below) |
If the request body (in Graph Explorer) is
It returns the exception mentioned above: |
@bolt-io Any chance you can confirm the payload sent by the SDK using fiddler or running the code below from your end? User updatedUser = new() { GivenName = "someValue" };
var stringValue = await KiotaJsonSerializer.SerializeAsStringAsync(updatedUser); The json string produced from my end does not contain the displayName property set to null when we run this. |
Thanks @MartinM85 and @andrueastman.
Correct. The JSON string payload only contains Givenname and OData.Type. This is what I would have expected the Graph SDK to send. However, I have found the reason it was not serializing correctly. var graphuser = new User() { GivenName = "someValue" };
User updatedUser = JsonSerializer.Deserialize<User>(JsonSerializer.Serialize(graphuser));
var stringValue = await KiotaJsonSerializer.SerializeAsStringAsync(updatedUser); Turns out if you do any pre-serialization on the object, even if the This can be negated by serialising with options Thanks folks for the help, issue was between keyboard and chair (and some dodgy code) 😅 |
Thanks for confirming @bolt-io. Closing this one for now. |
Describe the bug
I am trying to update a user's surname but forced to provide a value for displayName for any patch requests. This is not a required field from the Microsoft Graph API.
Response error:
Expected behavior
The user is updated without the forced requirement of
displayName
being provided.How to reproduce
Run the following code snippet against the Graph Service Client with a valid user ID
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: