.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Get all the languages packs installed on web servers in the SharePoint 2010 farm

Posted By:Vijai Anand. R       Posted Date: May 14, 2011    Points: 40    Category: SharePoint    URL: http://www.dotnetspark.com  

In this we will be seeing how to get all the languages packs installed on web servers in the SharePoint 2010 farm.
 

 

Steps Involved:

·         Open Visual Studio 2010.

·         Go to File => New => Project.

·         Select Console Application Template from the installed templates.

·         Enter the name and click on Ok.

·         Add the following assembly.

o    Microsoft.SharePoint.dll

·         Add the following Namespace.

o    Using Microsoft.SharePoint;

·         Replace

using System; 

using System.Collections.Generic; 

using System.Linq; 

using System.Text; 

using Microsoft.SharePoint; 

  

namespace Languages 

{ 

    class Program 

    { 

        static void Main(string[] args) 

        { 

            using (SPSite site = new SPSite("http://serverName:22222/sites/Test/")) 

            { 

                using (SPWeb web = site.RootWeb) 

                { 

                    SPLanguageCollection installedLanguages = web.RegionalSettings.InstalledLanguages; 

                    foreach (SPLanguage language in installedLanguages) 

                    { 

                        Console.WriteLine("Name: {0}, LCID:{1}", language.DisplayName, language.LCID); 

                    } 

                    Console.ReadLine(); 

                } 

            } 

        } 

    } 

}      

          

 Program.cs with the following code.



     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend