Version

Search.query

This method is used to search resources within a SharePoint site and can receive an optional text (String) to search for.

Syntax

SPlus.Search.query (url, text, function (resources){
        for (var i=0; i < resources.length; i++) {//Loop the resources Array
            var resource = resources [i];//Getting a JSON object with the requested fields
            var title = resource['title']; //Getting one of the fields
            var properties = resource['properties']; //Getting the properties array
            for (var i=0; i < properties.length; i++){
            //TODO: Implement what to do with each one of the resource’s properties
            }
        //TODO: Implement what to do with each resource and its properties
        }
}, 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.query Parameters

Parameter

Type

Description

url

String

URL to the SharePoint site.

text

String

Optional text parameter used to search the site.

onSuccess callback function

Parameter

Description

function (resources)

Success callback function to be implemented, which retrieves the resources array containing JSON Objects with the results from the SharePoint site.

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.