Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,273 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have an attribute set named "TestSet" with the attribute "TestString". When attempting to set this attribute value as follows, an ODataError is thrown with Error.Message "Invalid property 'TestSet'.". However, I am able to set these values via the Azure UI.
if (!string.IsNullOrWhiteSpace(user.Degree))
{
var patch = new User();
patch.CustomSecurityAttributes ??= new CustomSecurityAttributeValue();
patch.CustomSecurityAttributes.AdditionalData.Add("TestSet", new
{
OdataType = "#Microsoft.DirectoryServices.CustomSecurityAttributeValue",
TestString = user.Degree,
});
await _client.Users[newUserId].PatchAsync(patch);
}
The issue is with how "OdataType" is serialized in JSON. Microsoft needs to update their documentation for this as what they have does not work.