SharePoint Online CSOM Update Region Settings

By | 2017-12-11T10:32:54+00:00 April 8th, 2016|Sharepoint|0 Comments

Just a quick post with an example of how to update a SharePoint Online Site Collection’s Region settings via SharePoint Online Management Shell.

  • First, set up your ClientContext in the normal manner:
$Password = ConvertTo-SecureString -String "yourPassword" -AsPlainText -Force;
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext("https://tenant.sharepoint.com/sites/yourSiteCollection");
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials("user@company.com, $Password);
  • Now we need to set up our target web site object:
$web = $ctx.Web;
$ctx.Load($web);
$ctx.ExecuteQuery();
  • Next, update the settings. In this example, I’m setting the LocaleId to 2057 (en-UK)
$web.RegionalSettings.LocaleId = 2057;
$web.Update();
  • Finally, run the ExecuteQuery method to apply the changes:
$ctx.ExecuteQuery();

 

References

  • Locale Identity (LCID): https://msdn.microsoft.com/en-gb/goglobal/bb964664
  • ClientContext.Web Property: https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.clientcontext.web.aspx

Leave A Comment

like what you see? 

Sign-up to our newsletter and never miss out on the latest blogs, events and tech news from the world of risual
SUBSCRIBE!
Give it a try, you can unsubscribe anytime.