2017-11-21 12 views
1

データタイプがstringCollectioncustom attributeを定義し、Azure AD Graph APIを使用して更新できますか?私の実験は失敗している:指定されたコンテンツの種類とエンコーディングのためADグラフAPIを使用したB2Cカスタム属性文字列コレクションの更新

リクエストボディは、予期しない文字が含まれている/コンテンツ


は、カスタム属性の定義

<ClaimType Id="extension_array_test"> 
    <DisplayName>Array Test</DisplayName> 
    <DataType>stringCollection</DataType> 
    <UserHelpText>Array Test in Token</UserHelpText> 
</ClaimType> 

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." 
    } 
    } 
} 

答えて

1

を使用して、あなたが状態の拡張を提供するドキュメントの2番目の音符は、現在唯一の文字列データ型をサポートする属性。

"extension_{GUID}_JsonAttribute": "{\"Item1\":\"Test\",\"Item2\":\"Data\"}" 
+0

おかげnyoung:あなたはこのようにエスケープJSONとしてあなたのデータを格納することができ、代替として

。そのドキュメントは古くなっており、boolとintもサポートしています。この[PR](https://github.com/MicrosoftDocs/azure-docs/pull/3775)を参照してください。 – spottedmahn

+0

B2Cは 'stringCollections'をサポートします。[this code](https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/blob/3b4898fec3bf0014b320beffa6eb52ad68eb6111/LocalAccounts/TrustFrameworkBase.xml#L185)を参照してください。 – spottedmahn

+1

B2Cは、クレームと標準のAAD属性( 'otherMails'など)の' stringCollections 'をサポートしていますが、あなたが指摘しているように、拡張属性のデータ型はstring、bool、intです。 – nyoung

関連する問題