本文介绍了通过AD Graph API更新B2C自定义属性字符串集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以定义自定义属性(其数据类型为stringCollection
)并通过Azure AD Graph API对其进行更新?我的实验失败了:
Can I define a custom attribute whose data type is stringCollection
and update it via the Azure AD Graph API? My experiment is failing:
自定义属性定义
<ClaimType Id="extension_array_test">
<DisplayName>Array Test</DisplayName>
<DataType>stringCollection</DataType>
<UserHelpText>Array Test in Token</UserHelpText>
</ClaimType>
Using the Graph API Sample client
{
"extension_[my-guid]_array_test": ["value 1", "value 2"]
}
Error Calling the Graph API:
{
"odata.error": {
"code": "Request_BadRequest",
"message": {
"lang": "en",
"value": "The request body contains unexpected characters/content for the specified content type and encoding."
}
}
}
推荐答案
您提供的文档中的第二个注释指出扩展属性当前仅支持字符串数据类型.
The second note in the documentation you provided states extension attributes currently only support the string data type.
作为替代方案,您可以像这样将数据存储为转义的JSON:
As an alternative you could store your data as escaped JSON like this:
"extension_{GUID}_JsonAttribute": "{\"Item1\":\"Test\",\"Item2\":\"Data\"}"
这篇关于通过AD Graph API更新B2C自定义属性字符串集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!