0
votes

I'm new to SP Services and programming in general,so your help and support will be very much appreciated!I have a task to find a way to get all subsites from a SharePoint page,then to get all lists/libraries from each subsite,then to get the content of each list/library,preferably with SP Services.So would be very much appreciated for some help/solution,if it's already been asked,as I couldn't find that question specifically,do please forward that info to me.Any suggestions are more than welcome,thanks in advance!

1

1 Answers

1
votes

Here is the solution that worked,list content is not exported:

        $(document).ready(function() {
            $().SPServices({
                operation: "GetAllSubWebCollection",
                webURL:"your site here",
                async: false,
                completefunc: function(xData, Status) {
                    
                    $(xData.responseXML).SPFilterNode("Web").each(function(){
                        $('#outputDataDiv').append("<div class='webRecordTitle'>"
                        +$(this).attr("Title")+" : "
                        + $(this).attr("Url")+"</div>");
                        getListCollection($(this).attr("Url"));
                    });
                }
            });

            function getListCollection(webAddress){
                $().SPServices({
                operation: "GetListCollection",
                webURL:webAddress,
                async: false,
                completefunc: function(xData, Status) {
                    $(xData.responseXML).SPFilterNode("List").each(function(){
                    if(
                    $(this).attr("ServerTemplate")==101
                    && $(this).attr("Title")!=="Style Library"
                    && $(this).attr("Title")!=="Site Assets")
                    {
                    var outputListHtml = "<div class='listContainer'>"+
                    "<span class='listTitle'>"
                    +$(this).attr("Title")
                    + "</span><br />";
                    outputListHtml += "Total Item Count: "+$(this).attr("ItemCount")+" ";
                    outputListHtml +="</div>";
                    $('#outputDataDiv').append(outputListHtml);
                    }
                    });
                    }
                });
            }
        })