【问题标题】:how do I know if the specific list is a document library?我如何知道特定列表是否为文档库?
【发布时间】:2016-03-10 10:42:35
【问题描述】:

当我使用我的客户端程序从特定的 SharePoint 服务器获取所有列表时,我会获取很多列表,但我只想向用户展示文档库。我怎样才能做到这一点?我看到图书馆可以命名任何东西,而不仅仅是“共享文档”,那么肯定还有另一种可能性?我目前正在使用 WSS/SOAP 并使用 GetListsCollection 方法与 _vti_bin/lists.asmx 服务通信,但任何线索都会有所帮助。

我的代码

var getSharepointDocumentLibrary = '' + '' + '' + '' + '' + '';

        try {
            $.ajax({
                url: url,
                type: "POST",
                dataType: "xml",
                data: getSharepointDocumentLibrary,
                username: domainName + "\\" + userName,
                password: passWord,
                crossDomain: true,
                headers: {
                    //"SOAPAction": "http://schemas.microsoft.com/sharepoint/soap/GetList",
                    "SOAPAction": "http://schemas.microsoft.com/sharepoint/soap/GetListCollection",
                    "Content-Type": "text/xml; charset=utf-8",
                    "Origin": "*",
                    "Access-Control-Request-Method": "POST",
                    "Access-Control-Request-Headers": "accept, authorization, origin, X-Custom-Header",
                    "Authorization": 'Basic ' + window.btoa(unescape(encodeURIComponent(domainName + "\\" + userName + ':' + passWord)))
                },


            }).done(function (xmlDoc, status, responseObj) {
                alert('success');

                //alert(responseObj.responseText);
              ////  addOptionInSelectize("serverNames", serverName, serverName);
              ////  changeSelectionByValue("serverNames", serverName);
                //  changeSelectionByValue("serverNames", serverName);

                addServerInDropDownList(serverName,domainName);
                navigate('indexPage', 'homePage');


            })
                .fail(function (xmlDoc, status, responseObj) {
                    alert('failure');                           
                    alert(xmlDoc.status);
                    alert(xmlDoc.message);

                    $("#loginPopup2").show();
                    //alert(responseObj.responseText);

                })

【问题讨论】:

    标签: sharepoint


    【解决方案1】:

    您可以根据每个 List 节点的 ServerTemplate 属性从 Web 服务响应中识别文档库。 Document Libraries 的 ServerTemplate 值为 101。因此,您只需从响应中提取所有具有 ServerTemplate = "101" 的 List 节点即可获取所有文档库。
    有关 ServerTemplate 代码的完整列表,请参阅下面的 MSDN 链接:
    https://msdn.microsoft.com/en-us/library/hh658949%28v=office.12%29.aspx

    【讨论】:

      猜你喜欢
      • 2019-07-22
      • 1970-01-01
      • 2015-09-13
      • 2016-05-19
      • 1970-01-01
      • 1970-01-01
      • 2020-08-18
      • 1970-01-01
      • 2021-06-22
      相关资源
      最近更新 更多