创建 organizationalBrandingLocalization
命名空间:microsoft.graph
创建新的 组织BrandingLocalization 对象。 这会创建一个本地化品牌,同时,如果不存在,则创建默认品牌。
默认品牌创建仅一次。 如果未为用户的浏览器语言配置本地化品牌,则会加载它。 若要检索默认品牌,请参阅 Get 品牌。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
Organization.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
| Application |
不支持。 |
HTTP 请求
此请求创建新的本地化品牌和默认品牌(如果尚不存在)。
POST /organization/{organizationId}/branding/localizations
| 名称 |
说明 |
| Authorization |
Bearer {token}。必需。 |
| Content-Type |
application/json. Required. |
请求正文
下表显示了创建 组织BrandingLocalization 对象时所需的属性。
| 属性 |
类型 |
说明 |
| id |
String |
一个标识符,表示使用区域性名称指定的区域设置。 区域性名称遵循 RFC 1766 标准,格式为“languagecode2-country/regioncode2”,其中“languagecode2”是派生自 ISO 639-1 的小写双字母代码,“country/regioncode2”是派生自 ISO 3166 的大写双字母代码。 例如,美国英语是 en-US. 无法通过将 ID 的值设置为字符串类型或default字符串类型0来创建默认品牌。
注意: 目前不支持单个区域设置的多个品牌。 |
响应
如果成功,此方法在响应正文中返回 201 Created 响应代码和 组织BrandingLocalization 对象。
示例
以下示例为法语 () fr-FR 本地化创建品牌本地化。 String 类型的任何未指定属性都继承自默认品牌对象中的值。 例如,如果默认品牌对象中的 signInPageText 为 null,则此请求中创建的品牌的 signInPageText fr-FR 也将为 null。 若要重写 null 不带任何文本的值,请使用仅包含空格的字符串。
请求
下面展示了示例请求。
POST https://graph.microsoft.com/v1.0/organization/d69179bf-f4a4-41a9-a9de-249c0f2efb1d/branding/localizations
Content-Type: application/json
{
"backgroundColor":"#00000F",
"id": "fr-FR",
"signInPageText": " "
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var organizationalBrandingLocalization = new OrganizationalBrandingLocalization
{
BackgroundColor = "#00000F",
Id = "fr-FR",
SignInPageText = " "
};
await graphClient.Organization["{organization-id}"].Branding.Localizations
.Request()
.AddAsync(organizationalBrandingLocalization);
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const organizationalBrandingLocalization = {
backgroundColor: '#00000F',
id: 'fr-FR',
signInPageText: ' '
};
await client.api('/organization/d69179bf-f4a4-41a9-a9de-249c0f2efb1d/branding/localizations')
.post(organizationalBrandingLocalization);
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/organization/d69179bf-f4a4-41a9-a9de-249c0f2efb1d/branding/localizations"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphOrganizationalBrandingLocalization *organizationalBrandingLocalization = [[MSGraphOrganizationalBrandingLocalization alloc] init];
[organizationalBrandingLocalization setBackgroundColor:@"#00000F"];
[organizationalBrandingLocalization setId:@"fr-FR"];
[organizationalBrandingLocalization setSignInPageText:@" "];
NSError *error;
NSData *organizationalBrandingLocalizationData = [organizationalBrandingLocalization getSerializedDataWithError:&error];
[urlRequest setHTTPBody:organizationalBrandingLocalizationData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
OrganizationalBrandingLocalization organizationalBrandingLocalization = new OrganizationalBrandingLocalization();
organizationalBrandingLocalization.backgroundColor = "#00000F";
organizationalBrandingLocalization.id = "fr-FR";
organizationalBrandingLocalization.signInPageText = " ";
graphClient.organization("d69179bf-f4a4-41a9-a9de-249c0f2efb1d").branding().localizations()
.buildRequest()
.post(organizationalBrandingLocalization);
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewOrganizationalBrandingLocalization()
backgroundColor := "#00000F"
requestBody.SetBackgroundColor(&backgroundColor)
id := "fr-FR"
requestBody.SetId(&id)
signInPageText := " "
requestBody.SetSignInPageText(&signInPageText)
organizationId := "organization-id"
result, err := graphClient.OrganizationById(&organizationId).Branding().Localizations().Post(requestBody)
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Identity.DirectoryManagement
$params = @{
BackgroundColor = "#00000F"
Id = "fr-FR"
SignInPageText = " "
}
New-MgOrganizationBrandingLocalization -OrganizationId $organizationId -BodyParameter $params
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
响应
下面展示了示例响应。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#organization('d69179bf-f4a4-41a9-a9de-249c0f2efb1d')/branding/localizations/$entity",
"@odata.id": "https://graph.microsoft.com/v2/d69179bf-f4a4-41a9-a9de-249c0f2efb1d/directoryObjects/$/Microsoft.DirectoryServices.Organization('d69179bf-f4a4-41a9-a9de-249c0f2efb1d')//localizations/fr-FR",
"id": "fr-FR",
"backgroundColor": "",
"backgroundImageRelativeUrl": null,
"bannerLogoRelativeUrl": null,
"cdnList": [],
"signInPageText": " ",
"squareLogoRelativeUrl": null,
"usernameHintText": ""
}