Trying to use Web LCID property to get the List name in client object Model

Hi ,

I am trying to change the "Personal Documents" list NoCrawl property under MySite using SharePoint Client Object Model. As we use  web.Lists.GetByTitle("Personal Documents"); method to get the list,but here problem is :for different language List name is in their language.So I tried to use LCID property of the WEB and have taken key-value pair (PersonalSiteOnet_List_PersonalDocuments) from the resource file for that language from 14 hive.

Example:I have selected Spanish language .there are so many LCID for Spanish language but Microsoft has given only one language pack for Spanish.

Then,My Question is that "All LCID for Spanish language are using same Spanish language pack dictionary file OR something else"

 
January 14th, 2014 3:09pm

Hi,

According to your post, my understanding is that your requirement is getting list in different language.

Here are two ways for your reference:

1. We can use getById method instead, so that we can avoid the language issue.

2. We can use an array to store the different list name in different language in you JavaScript code, then use the code snippet below to get the list:

var userLcid =_spPageContextInfo.currentLanguage;
var localizedStrings = {
   ListName: {
    _1033: "EnglishName",
    _3082: "SpanishName"
   }
};
var listName=localizedStrings.ListName["_" + userLcid];

var list=web.Lists.getByTitle(listName);

More information:
http://msdn.microsoft.com/en-us/library/hh670609.aspx
http://wellytonian.com/2012/11/language-packs-sharepoint-2010/

Best Regards

Free Windows Admin Tool Kit Click here and download it now
January 15th, 2014 4:34pm

Thankyou Dennis for your answer.

My approach is same as you have suggested. Only thing I want to confirm that all Spanish language versions (Spanish (Argentina),Spanish (Bolivia),Spanish (Chile),Spanish (Colombia)) are using the same resource file given by Spanish Language Pack of Microsoft.

Again so many thanks for your response.

January 15th, 2014 5:45pm

Why not trying to get the list from URL  using the parent SPWeb object

SPWeb.GetList

where the SPWeb is you current variation all the urls will be the same 

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.getlist.aspx

Free Windows Admin Tool Kit Click here and download it now
January 15th, 2014 11:10pm

Hi Amr M,

I am using SharePoint Client object model, so there I am not using server side assembly.

We can not get SPWeb.GetList method in client side.

January 16th, 2014 10:25am

hi,

I got my answer ,It,s not possible to access SharePoint resource files from 14 hive using SharePoint Client Object Model.Only thing we can do,We can copy the different language value from 14 hive and use it.(Either creating new resource file or in coding directly ) 

Free Windows Admin Tool Kit Click here and download it now
February 8th, 2014 11:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics