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

Sathish Nadarajan
 
Solution Architect
July 7, 2017
 
Rate this article
 
Views
4433

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.

Author Info

Sathish Nadarajan
 
Solution Architect
 
Rate this article
 
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 15+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business ...read more
 

Leave a comment