Version

Web.getWebsAndLists

This method is used to get the sub-webs and lists of a SharePoint site.

Syntax

SPlus.Web.getWebsAndLists (url, function (webs, lists){
        for (var i=0; i < webs.length; i++) {//Loop the webs Array
            var web = webs [i];//Getting a JSON object with title and url properties
            var webTitle = web['title'];//Getting one of the properties of web
            //TODO: Implement what to do with each web element
        }
        for (var j=0; j < lists.length; j++) {//Loop the lists Array
            var list = lists [j];//Getting a JSON object with several properties
            var listTemplate = list['template'];//Getting one of the properties of list
            //TODO: Implement what to do with each list element
        }
}, function (errorResponse){
        var error = errorResponse['error#displayValue']; //Getting the error
        //TODO: Implement how to handle errors
}, function (cancelResponse){
        //TODO: Implement how to handle a user’s cancel
});

Web.getWebsAndLists Parameters

Parameter

Type

Description

url

String

URL to the SharePoint site

onSuccess callback function

Parameter

Description

function (webs, lists)

Success callback function to be implemented, which receives two Arrays (web, lists) containing JSON Objects.

onError callback function

Parameter

Description

function (eResponse)

Error callback function to be implemented, which receives the eResponse JavaScript Object.

onCancel callback function

Parameter

Description

function (result)

Cancel callback function to be implemented.