How to Enable Multi Language Settings in a SharePoint Office 365 Site Programmatically Using C# Client Site Object Model (CSOM)


Sathish Nadarajan
SharePoint MVP
Published On :   07 Jul 2017
Visit Count
Today :  1    Total :   493
Plan, Migrate, Secure, Report
SharePoint & Office 365 Tool. Simple & Easy to Use. 15-Day Trial!

Sharegate: Kick-Ass Tool
Think Your SharePoint & Office 365 Are Secure ? Find Out Now!


As I said earlier articles, during the deployment we need to do a series of actions. As part of that, let us see, how to enable the multi-language settings and select the languages.

The settings in the screen is available on the Site Settings.

clip_image002

clip_image004

Now, let us see the code, which will enable and select few languages as alternate languages.

 using Microsoft.SharePoint.Client;
 
 namespace Office365.Console
 {
     class Program
     {
         static void Main(string[] args)
         {
             ConfigureSearchCentreURL();
         }
 
         public static void ConfigureSearchCentreURL()
         {
             OfficeDevPnP.Core.AuthenticationManager authMgr = new OfficeDevPnP.Core.AuthenticationManager();
 
             string sourceSiteUrl = "https://******.sharepoint.com/sites/communitysite";
             
             string userName = "Sathish@******.onmicrosoft.com";
             string password = "******";
 
             var clientContext = authMgr.GetSharePointOnlineAuthenticatedContextTenant(sourceSiteUrl, userName, password);
 
             Web web = clientContext.Web;
             clientContext.Load(web);
 
             web.IsMultilingual = true;
             web.AddSupportedUILanguage(1033); // English
             web.AddSupportedUILanguage(1031); // German
             web.AddSupportedUILanguage(1036); // French
             web.AddSupportedUILanguage(1046); // Portugese (Brazil)
             web.AddSupportedUILanguage(1049); // Russian
             web.AddSupportedUILanguage(2052); // Chinese (Simplified)
             web.AddSupportedUILanguage(3082); // Spanish
 
             web.Update();
 
             clientContext.ExecuteQuery();
         }
 
     }
 }
 

Happy Coding,

Sathish Nadarajan.

SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Categories

KWizCom Forms App