Version

Search.getScopes

This method is used to retrieve the existing scopes for a SharePoint site.

Syntax

SPlus.Search.getScopes (url, function (scopes){
        for (var i=0; i < scopes.length; i++) {//Loop the scopes Array
            var scope = scopes [i];//Getting one of the requested scopes
            //TODO: Implement what to do with the scopes
        }
}, 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
});

Search.getScopes Parameters

Parameter

Description

function (scopes)

Success callback function to be implemented, which receives an Array with the scopes.

onSuccess callback function

Parameter

Description

function (result)

Success callback function to be implemented, which receives an Array with the scopes.

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.

Note

Note: When using the Search.queryWithOptions method, you may want to specify the scope. As scopes vary depending on the site, it is highly recommended that you first retrieve all scopes for a site using the Search.getScopes method.