Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Update some or all of the properties of a regionalAndLanguageSettings object.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
✅ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
User.ReadWrite |
User.ReadWrite.All |
Delegated (personal account) |
User.ReadWrite |
User.ReadWrite.All |
Application |
User.ReadWrite |
User.ReadWrite.All |
HTTP request
To update all of a user's regional and language settings:
PUT /me/settings/regionalAndLanguageSettings
PUT /users/{user-id | userPrincipalName}/settings/regionalAndLanguageSettings
Note
Calling the /me
endpoint requires a signed-in user and therefore a delegated permission. Application permissions aren't supported when using the /me
endpoint.
To update a subset of the properties of a user's regional and language settings:
PATCH /me/settings/regionalAndLanguageSettings
PATCH /users/{user-id | userPrincipalName}/settings/regionalAndLanguageSettings
Note
Calling the /me
endpoint requires a signed-in user and therefore a delegated permission. Application permissions aren't supported when using the /me
endpoint.
Request body
PUT: In the request body, supply a regionalAndLanguageSettings object.
PATCH: Only supply the values for relevant fields that should be updated. Existing properties that are not included in the request body will maintain their previous values or be recalculated based on changes to other property values. For best performance you shouldn't include existing values that haven't changed.
Response
If successful, this method returns a 204 No Content
response code. It doesn't return anything in the response body.
Example
Example 1: Update the entire regionalAndLanguageSettings object of the signed-in user
Request
The following example shows a request.
PUT https://graph.microsoft.com/beta/me/settings/regionalAndLanguageSettings
Content-type: application/json
{
"defaultDisplayLanguage": {
"locale": "en-US"
},
"authoringLanguages": [
{
"locale": "fr-FR"
},
{
"locale": "de-DE"
}
],
"defaultTranslationLanguage": {
"locale": "en-US"
},
"defaultSpeechInputLanguage": {
"locale": "en-US"
},
"defaultRegionalFormat": {
"locale": "en-GB"
},
"regionalFormatOverrides": {
"calendar": "Gregorian Calendar",
"firstDayOfWeek": "Sunday",
"shortDateFormat": "yyyy-MM-dd",
"longDateFormat": "dddd, MMMM d, yyyy",
"shortTimeFormat": "HH:mm",
"longTimeFormat": "h:mm:ss tt",
"timeZone": "Pacific Standard Time"
},
"translationPreferences": {
"translationBehavior": "Yes",
"languageOverrides": [
{
"languageTag": "fr",
"translationBehavior": "Yes"
}
]
}
}
const options = {
authProvider,
};
const client = Client.init(options);
const regionalAndLanguageSettings = {
defaultDisplayLanguage: {
locale: 'en-US'
},
authoringLanguages: [
{
locale: 'fr-FR'
},
{
locale: 'de-DE'
}
],
defaultTranslationLanguage: {
locale: 'en-US'
},
defaultSpeechInputLanguage: {
locale: 'en-US'
},
defaultRegionalFormat: {
locale: 'en-GB'
},
regionalFormatOverrides: {
calendar: 'Gregorian Calendar',
firstDayOfWeek: 'Sunday',
shortDateFormat: 'yyyy-MM-dd',
longDateFormat: 'dddd, MMMM d, yyyy',
shortTimeFormat: 'HH:mm',
longTimeFormat: 'h:mm:ss tt',
timeZone: 'Pacific Standard Time'
},
translationPreferences: {
translationBehavior: 'Yes',
languageOverrides: [
{
languageTag: 'fr',
translationBehavior: 'Yes'
}
]
}
};
await client.api('/me/settings/regionalAndLanguageSettings')
.version('beta')
.put(regionalAndLanguageSettings);
Response
The following example shows the response.
HTTP/1.1 204 No Content
Example 2: Update selected properties of the signed-in user
Request
The following example shows a request.
PATCH https://graph.microsoft.com/beta/me/settings/regionalAndLanguageSettings
Content-type: application/json
{
"authoringLanguages": [
{
"locale": "en-US" },
{
"locale": "es-MX" }
],
"defaultRegionalFormat": {
"locale": "en-US"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new RegionalAndLanguageSettings
{
AuthoringLanguages = new List<LocaleInfo>
{
new LocaleInfo
{
Locale = "en-US",
},
new LocaleInfo
{
Locale = "es-MX",
},
},
DefaultRegionalFormat = new LocaleInfo
{
Locale = "en-US",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Settings.RegionalAndLanguageSettings.PatchAsync(requestBody);
mgc-beta users settings regional-and-language-settings patch --user-id {user-id} --body '{\
"authoringLanguages": [\
{\
"locale": "en-US" },\
{\
"locale": "es-MX" }\
],\
"defaultRegionalFormat": {\
"locale": "en-US"\
}\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewRegionalAndLanguageSettings()
localeInfo := graphmodels.NewLocaleInfo()
locale := "en-US"
localeInfo.SetLocale(&locale)
localeInfo1 := graphmodels.NewLocaleInfo()
locale := "es-MX"
localeInfo1.SetLocale(&locale)
authoringLanguages := []graphmodels.LocaleInfoable {
localeInfo,
localeInfo1,
}
requestBody.SetAuthoringLanguages(authoringLanguages)
defaultRegionalFormat := graphmodels.NewLocaleInfo()
locale := "en-US"
defaultRegionalFormat.SetLocale(&locale)
requestBody.SetDefaultRegionalFormat(defaultRegionalFormat)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
regionalAndLanguageSettings, err := graphClient.Me().Settings().RegionalAndLanguageSettings().Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
RegionalAndLanguageSettings regionalAndLanguageSettings = new RegionalAndLanguageSettings();
LinkedList<LocaleInfo> authoringLanguages = new LinkedList<LocaleInfo>();
LocaleInfo localeInfo = new LocaleInfo();
localeInfo.setLocale("en-US");
authoringLanguages.add(localeInfo);
LocaleInfo localeInfo1 = new LocaleInfo();
localeInfo1.setLocale("es-MX");
authoringLanguages.add(localeInfo1);
regionalAndLanguageSettings.setAuthoringLanguages(authoringLanguages);
LocaleInfo defaultRegionalFormat = new LocaleInfo();
defaultRegionalFormat.setLocale("en-US");
regionalAndLanguageSettings.setDefaultRegionalFormat(defaultRegionalFormat);
RegionalAndLanguageSettings result = graphClient.me().settings().regionalAndLanguageSettings().patch(regionalAndLanguageSettings);
const options = {
authProvider,
};
const client = Client.init(options);
const regionalAndLanguageSettings = {
authoringLanguages: [
{
locale: 'en-US' },
{
locale: 'es-MX' }
],
defaultRegionalFormat: {
locale: 'en-US'
}
};
await client.api('/me/settings/regionalAndLanguageSettings')
.version('beta')
.update(regionalAndLanguageSettings);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\RegionalAndLanguageSettings;
use Microsoft\Graph\Beta\Generated\Models\LocaleInfo;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new RegionalAndLanguageSettings();
$authoringLanguagesLocaleInfo1 = new LocaleInfo();
$authoringLanguagesLocaleInfo1->setLocale('en-US');
$authoringLanguagesArray []= $authoringLanguagesLocaleInfo1;
$authoringLanguagesLocaleInfo2 = new LocaleInfo();
$authoringLanguagesLocaleInfo2->setLocale('es-MX');
$authoringLanguagesArray []= $authoringLanguagesLocaleInfo2;
$requestBody->setAuthoringLanguages($authoringLanguagesArray);
$defaultRegionalFormat = new LocaleInfo();
$defaultRegionalFormat->setLocale('en-US');
$requestBody->setDefaultRegionalFormat($defaultRegionalFormat);
$result = $graphServiceClient->me()->settings()->regionalAndLanguageSettings()->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Users
$params = @{
authoringLanguages = @(
@{
locale = "en-US"
}
@{
locale = "es-MX"
}
)
defaultRegionalFormat = @{
locale = "en-US"
}
}
# A UPN can also be used as -UserId.
Update-MgBetaUserSettingRegionalAndLanguageSetting -UserId $userId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.regional_and_language_settings import RegionalAndLanguageSettings
from msgraph_beta.generated.models.locale_info import LocaleInfo
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = RegionalAndLanguageSettings(
authoring_languages = [
LocaleInfo(
locale = "en-US",
),
LocaleInfo(
locale = "es-MX",
),
],
default_regional_format = LocaleInfo(
locale = "en-US",
),
)
result = await graph_client.me.settings.regional_and_language_settings.patch(request_body)
Response
The following example shows the response.
HTTP/1.1 204 No Content