Documented C# SDK usage for assigning CSAs does not work
Describe the bug Documented C# SDK usage for assigning custom security attribute did not work
To Reproduce The following code example did not work https://learn.microsoft.com/en-us/graph/custom-security-attributes-examples?tabs=csharp#example-3-assign-a-custom-security-attribute-with-a-multi-string-value-to-a-user
Expected behavior Used this code instead var dict = new Dictionary<string, object> { { "@odata.type", "#microsoft.graph.customSecurityAttributeValue" }, { [email protected], "#Collection(String)" }, { "Programs", new string[] { "Baker", "Cascade" } } };
var attribute = JsonSerializer.SerializeToElement(dict);
var user = new User { CustomSecurityAttributes = new CustomSecurityAttributeValue { AdditionalData = new Dictionary<string, object>() { { "JadeAttributes", attribute } } } };
await _graphClient.Users[userId] .PatchAsync(user);
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Hi @andrueastman Can you review this feedback? Let me know if I didn't submit correctly. thanks
Thanks for raising this @rolyon
After investigation, it looks like the snippet generator is causing the issue here as the anonymous "Engineering" type is generated incorrectly causing incorrect serialization of the properties with special characters (i.e. @odata.type and [email protected]) hence the error.
@andrueastman will this fix the code generated for other languages (python,java) as well?