Get all subsites using SPServices in SharePoint 2013

<SCRIPT type=text/javascript src="/Style%20Library/ReadSubsites/jquery-1.11.1.js"></SCRIPT>
<SCRIPT type=text/javascript src="/Style%20Library/ReadSubsites/jquery.SPServices-0.7.2.min.js"></SCRIPT>
<SCRIPT type=text/javascript>

    var thisSite = $().SPServices.SPGetCurrentSite();
    get();
    function get() {

        $().SPServices
        ({
            operation: "GetWebCollection",
            webURL: $().SPServices.SPGetCurrentSite().toString(),
            async: false,
            completefunc: function (xData, status) {

                document.write("<table width='100%'>");              
                var a = 0;
                $(xData.responseXML).find("Web").each(function () {
                    a++;
                    var webtitle = $(this).attr("Title");
                    var weburlvar = $(this).attr("Url");
                    var webdesc = $(this).attr("Description");
                    document.write("<tr><td><a target='_blank' href='" +

weburlvar + "'>" + webtitle + "</a></td></tr>");
                });
                if (a < 1) {
                    document.write("<tr><td><font><b>No Site

Found</b></font></td></tr>");
                }
                document.write("</table>");

            }
        });
    }
</script>

Comments

Popular posts from this blog

IRM and the Object Model

This content database has a schema version which is not supported in this farm

Activate and Deactivate Feature through PowerShell