zoukankan      html  css  js  c++  java
  • SharePoint Web Service系列:获取网站LCID

    有时我们在使用Web Service时难免会用到SharePoint网站的区域ID。比如,根据不同的语言Update相应的值到列表里。又或者是调用为不同的语言准备的后台应用程序页面。

    如果把LCID硬编码到代码里,显然会限制我们程序的使用范围。也不符合我们的专业精神。那如何通过SharePoint Web Service 得到LCID呢?

    其实一点也不难。

    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;

     其中的关键是:

    1、SharePoint自带的SiteData.asmx 的调用

    2、WebMetadata中包含了我们需要的LCID(还有很多对我们有用的信息,比如Web ID,用户等等)

    3、对于有备用语言的网站,看到有人使用读取SharePoint自带的列表的Title的方法。比如“日历”。判断如果是“日历”,就是中文;如果是"Calendar",就是英文。对付这种多语言的网站,这也不失为一种解决办法。

    参考资料

    Understanding the Multilingual User Interface (MUI)

    How to get current Sharepoint site LCID in silverlight web part

  • 相关阅读:
    U-Boot新手入门
    安装交叉编译工具
    Makefile 工程管理
    gcc基本用法
    poj 3264 Balanced Lineup
    hdoj 1166 敌兵布阵
    poj 1363 Rails
    poj 1028 Web Navigation
    zoj 3621 Factorial Problem in Base K
    poj1861最小生成树
  • 原文地址:https://www.cnblogs.com/Sunmoonfire/p/2352044.html
Copyright © 2011-2022 走看看