列出语言
本文内容
命名空间:microsoft.graph
检索 B2C 用户流中支持自定义Azure AD列表。
注意: 若要检索支持自定义的语言列表,必须先在 B2C 用户流上Azure AD语言自定义。 有关详细信息,请参阅更新 b2cIdentityUserFlow 。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
IdentityUserFlow.Read.All、IdentityUserFlow.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
IdentityUserFlow.Read.All、IdentityUserFlow.ReadWrite.All
工作或学校帐户需要属于以下角色之一:
HTTP 请求
GET /identity/b2cUserFlows/{id}/languages
可选的查询参数
此方法支持 $filter 查询参数只显示已启用的语言。 若要了解一般信息,请参阅 OData 查询参数 。
名称
说明
Authorization
Bearer {token}。必需。
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在响应正文中返回 响应代码和 200 OK userFlowLanguageConfiguration 对象集合。
示例
示例 1:检索所有语言的列表
请求
下面展示了示例请求。
GET https://graph.microsoft.com/beta/identity/b2cUserFlows/B2C_1_CustomerSignUp/languages
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var languages = await graphClient.Identity.B2cUserFlows["{b2cIdentityUserFlow-id}"].Languages
.Request()
.GetAsync();
const options = {
authProvider,
};
const client = Client.init(options);
let languages = await client.api('/identity/b2cUserFlows/B2C_1_CustomerSignUp/languages')
.version('beta')
.get();
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/identity/b2cUserFlows/B2C_1_CustomerSignUp/languages"]]];
[urlRequest setHTTPMethod:@"GET"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
NSError *jsonError = nil;
MSCollection *collection = [[MSCollection alloc] initWithData:data error:&jsonError];
MSGraphUserFlowLanguageConfiguration *userFlowLanguageConfiguration = [[MSGraphUserFlowLanguageConfiguration alloc] initWithDictionary:[[collection value] objectAtIndex: 0] error:&nserror];
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
UserFlowLanguageConfigurationCollectionPage languages = graphClient.identity().b2cUserFlows("B2C_1_CustomerSignUp").languages()
.buildRequest()
.get();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
b2cIdentityUserFlowId := "b2cIdentityUserFlow-id"
result, err := graphClient.Identity().B2cUserFlowsById(&b2cIdentityUserFlowId).Languages().Get()
响应
下面展示了示例响应。
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-Type: application/json
{
"odata.context": "https://graph.microsoft.com/beta/$metadata#identity/b2cUserFlows('B2C_1_CustomerSignUp')/languages",
"value": [
{
"id": "en",
"isEnabled": true,
"displayName": "English"
},
{
"id": "de",
"isEnabled": false,
"displayName": "Deutsch"
}
]
}
示例 2:检索仅启用语言的列表
请求
下面展示了示例请求。
GET https://graph.microsoft.com/beta/identity/b2cUserFlows/B2C_1_CustomerSignUp/languages?$filter=isEnabled eq true
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var languages = await graphClient.Identity.B2cUserFlows["{b2cIdentityUserFlow-id}"].Languages
.Request()
.Filter("isEnabled eq true")
.GetAsync();
const options = {
authProvider,
};
const client = Client.init(options);
let languages = await client.api('/identity/b2cUserFlows/B2C_1_CustomerSignUp/languages')
.version('beta')
.filter('isEnabled eq true')
.get();
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/identity/b2cUserFlows/B2C_1_CustomerSignUp/languages?$filter=isEnabled%20eq%20true"]]];
[urlRequest setHTTPMethod:@"GET"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
NSError *jsonError = nil;
MSCollection *collection = [[MSCollection alloc] initWithData:data error:&jsonError];
MSGraphUserFlowLanguageConfiguration *userFlowLanguageConfiguration = [[MSGraphUserFlowLanguageConfiguration alloc] initWithDictionary:[[collection value] objectAtIndex: 0] error:&nserror];
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
UserFlowLanguageConfigurationCollectionPage languages = graphClient.identity().b2cUserFlows("B2C_1_CustomerSignUp").languages()
.buildRequest()
.filter("isEnabled eq true")
.get();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestParameters := &msgraphsdk.LanguagesRequestBuilderGetQueryParameters{
Filter: "isEnabled%20eq%20true",
}
options := &msgraphsdk.LanguagesRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
b2cIdentityUserFlowId := "b2cIdentityUserFlow-id"
result, err := graphClient.Identity().B2cUserFlowsById(&b2cIdentityUserFlowId).Languages().GetWithRequestConfigurationAndResponseHandler(options, nil)
响应
下面展示了示例响应。
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-Type: application/json
{
"odata.context": "https://graph.microsoft.com/beta/$metadata#identity/b2cUserFlows('B2C_1_CustomerSignUp')/languages",
"value": [
{
"id": "en",
"isEnabled": true,
"displayName": "English"
}
]
}