Version

List.getItems

This method is used to get the items in a SharePoint List from a specified URL and list view. Only the field values included in the array passed to the query will be retrieved.

Syntax

SPlus.List.getItems (url, viewName, fields, function (items){
        for (var i=0; i < items.length; i++) {//Loop the items Array
            var item = items [i];//Getting a JSON object with the requested fields
            var title = item['ows_Title#displayValue']; //Getting one of the fields previously specified for each item
            //TODO: Implement what to do with each item
        }
}, 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
});

List.getItems Parameters

Parameter

Type

Description

url

String

URL to the SharePoint site.

viewName

String

Name of the SharePoint list view.

fields

Array

Field values to be retrieved fir each item.

onSuccess callback function

Parameter

Description

function (items)

Success callback function to be implemented, which receives one array (items) 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.

For a sample with this API method, refer to the Integrating APIs to your Mobile Workspace procedure.