Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / productivity / SharePoint / SharePoint2013

How To Get the Current Culture in SharePoint 2013

0.00/5 (No votes)
8 May 2016CPOL 10.8K  
How to get current culture in SharePoint 2013 Online? How to get current culture using client object model C#?

Introduction

Get UICulture/Current culture in Server Object Model is very easy. In Client Object Model, it is little bit of a problem. So this document aims to overcome it.

What is UICulture/Current Culture

It is the default language of a SharePoint Site. It can be found in Site Settings --> Regional Settings

uiculture

Using the Code

In Server Object Model, it is already there. SPWeb has a property named UICulture. Unfortunately, it is missing in Client Object Model. So what to do? I wrote the following:

C#
public string GetCultureOfTheWeb(ClientContext clientContext)
        {
            var web = clientContext.Web;
            clientContext.Load(web.RegionalSettings);
            clientContext.ExecuteQuery();
            var localId = (int) web.RegionalSettings.LocaleId;
            return new CultureInfo(localId).Name;
        }

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)