Programmatically enable Allow user to choose the language of their personal site in SharePoint 2010

 

In SharePoint 2010 open the Application Management section in the Central Administration, click on Manage Service Applications. Click on User Profile Service application. Go to My Site Settings, click on Setup My Sites.

 

 In that you could see an option “Language Options” which is used to allow the users to choose the language of their personal site.


Code Snippet:

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Microsoft.SharePoint;

using System.Web;

using Microsoft.Office.Server.UserProfiles;

 

namespace RemoveMySiteHostLocation

{

    class Program

    {

        static void Main(string[] args)

        {

            using (SPSite site = new SPSite("http://serverName:60001/sites/TestSiteColl"))

            {

                SPServiceContext serviceContext = SPServiceContext.GetContext(site);

                UserProfileManager upm = new UserProfileManager(serviceContext);

                upm.IsPersonalSiteMultipleLanguage = true;               

            }

        }

    }

}