SharePoint Web Service series: Get website LCID

Source: Internet
Author: User

Sometimes, when using Web services, we will inevitably use the Region ID of the SharePoint website. For example, Update values to the list based on different languages. Or call the background application page for different languages.

If hard-coded LCID into the code, it will obviously limit the scope of use of our program. It is not in line with our professionalism. Then how can we get LCID through SharePoint Web Service?

In fact, it is not difficult at all.

sitedataservice.SiteData sd;
sd = new sitedataservice.SiteData();
sd.Url = baseUrl + "/_vti_bin/sitedata.asmx";
sd.Credentials = System.Net.CredentialCache.DefaultCredentials;
sitedataservice._sWebMetadata webMetaData;
sitedataservice._sWebWithTime[] arrWebWithTime;
sitedataservice._sListWithTime[] arrListWithTime;
sitedataservice._sFPUrl[] arrUrls;
string roles; string[] roleUsers; string[] roleGroups;

uint i = sd.GetWeb(out webMetaData, out arrWebWithTime, out arrListWithTime, out arrUrls, out roles, out roleUsers, out roleGroups);
uint lcid = webMetaData.Language;

The key is:

1. Call SiteData. asmx provided by SharePoint

2. WebMetadata contains the LCID we need (there is a lot of useful information for us, such as Web ID, user, etc)

3. For websites with standby languages, you can see that someone uses the method of reading the Title of the list that comes with SharePoint. For example, "calendar ". If it is "Calendar", it is Chinese; if it is "Calendar", it is English. This is also a solution to this multilingual website.

References

Understanding the Multilingual User Interface (MUI)

How to get current Sharepoint site LCID in silverlight web part

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.