Skip to main content

Posts

Showing posts from August, 2016

Update user language and regional settings with CSOM

Following my previous post around multilingual aspects of SharePoint Online:  Modify Site Regional and Language settings with JSOM and JavaScript Here is some CSOM code which updates the personal regional settings of the current user or another user (if you are a tenant admin and have the rights to update user profiles) Before update: The code: using Microsoft.SharePoint.Client ; using Microsoft.SharePoint.Client.UserProfiles ; using System.Security ; namespace UpdateLanguagePreference { class Program { static void Main ( string[] args ) { //Tenant Admin Details string tenantAdministrationUrl = " https://yoursite-admin.sharepoint.com/ " ; string tenantAdminLoginName = " tenantadmin@yoursite.onmicrosoft.com " ; string tenantAdminPassword = " password " ; //AccountName of the user whos property you want to update.

Modify Site Regional and Default Language settings with JSOM and JavaScript

There are some really nice code examples for the CSOM Regional and Language APIs in the Office Dev PnP Library: https://github.com/OfficeDev/PnP/tree/master/Samples/Core.Settings.LocaleAndLanguage But, I could not find JSOM code example of these APIs. So I am listing down some of the most frequently used Regional and Language functions here. 1) Add a Supported UI Language: ( function () { " use strict " ; var context = SP . ClientContext . get_current (); var web = context . get_web (); //This is important. Wont work otherwise. web . set_isMultilingual ( true ); web . addSupportedUILanguage ( 1043 ); //Dutch //The full list of SharePoint 2013 and SharePoint Online LCIDs is here: //https://technet.microsoft.com/en-us/library/ff463597.aspx web . update (); context . executeQueryAsync ( function (){ console . log ( " Language Added " ); }, function ( sender , args )