-1

when I'm getting all the lists with my Client program from a specific SharePoint server, I'm getting quite a lot of them, but I'd like to present to the user only the Document Libraries. How can I do this? I saw that a Library can be named anything, not only "Shared Documents", so there must be another possibility? I'm currently using WSS/SOAP and talking to the _vti_bin/lists.asmx service with GetListsCollection method, but any clue will be helpful.

my code

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);

                })
adithyan .p
  • 121
  • 1
  • 3
  • 12

1 Answers1

0

You can identify the document libraries from the web service response on the basis of ServerTemplate attribute of each List node. The ServerTemplate value for Document Libraries in 101. Hence, you just need to extract all the List nodes having ServerTemplate = "101" from the response to get all the document libraries.
For complete list of ServerTemplate codes please refer to MSDN link below:
https://msdn.microsoft.com/en-us/library/hh658949%28v=office.12%29.aspx

Vineet Desai
  • 872
  • 5
  • 16