Hello everyone,
I've encountered an issue while adding a custom security attribute using the Microsoft Graph API. I'm hoping someone can help shed light on this situation.
Specifically, when I try to add the custom attribute "level" within the "org" part of the customSecurityAttributes object using the following JSON:
{
"customSecurityAttributes": {
"org": {
"level": 1,
"@odata.type": "#Microsoft.DirectoryServices.CustomSecurityAttributeValue"
}
}
}
I receive the following error: "'Integer value expected for attribute.'. ParameterName: 'org_level' ParameterValue: '1'."
However, when I manually retrieve the attribute for a user, its structure appears as follows:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(customSecurityAttributes)/$entity",
"customSecurityAttributes": {
"org": {
"@odata.type": "#microsoft.graph.customSecurityAttributeValue",
"employeetype": "student",
"level": 2
}
}
}
I've noticed that adding the employeetype attribute works fine. However, when attempting to add the "level" attribute with a numeric value, I encounter the mentioned error.
Does anyone have experience with this issue or know why this error is occurring? Is there a specific way that numeric values for customSecurityAttributes need to be formatted or represented?
Thank you in advance for any assistance!
Hi @Bambula
Believe you are trying to add the custom attribute "level" so you need to define the data type.
Try the below
{
"customSecurityAttributes": {
"org": {
"@odata.type": "#Microsoft.DirectoryServices.CustomSecurityAttributeValue",
"level@odata.type":"#Int32",
"level": 1
}
}
}
Thanks
Michael E. Gernaey
497
Super User 2025 Season 2
David_MA
436
Super User 2025 Season 2
Riyaz_riz11
244
Super User 2025 Season 2