Namespace: list

list

Namespaces

items

Methods

(static) byName(name) → {object}

exposes operations on a list qualified by name.
Parameters:
Name Type Description
name string a list name
Source:
Returns:
an object exposing operations possible on the list.
Type
object
Example
var list = sputils.list.byName('announcements');
list.getItems().then(...);

.byName(name).getItemById(data, config) → {Promise.<object>}

Returns the list item with the specified id.
Parameters:
Name Type Description
data object the payload
config Optional.<object> the http config
Source:
Returns:
List item
Type
Promise.<object>
Example
sputils.list.byName('Announcements').getItemById(1)
  .then(function (data) { console.log(data) });

.byName(name).getItems(config) → {Promise.<array>}

Returns the list items from the given list name.
Parameters:
Name Type Description
config Optional.<object> the http config
Source:
Returns:
the array containing the list items.
Type
Promise.<array>
Example
sputils.list.byName('Announcements').getItems()
  .then(function (data) { console.log(data.d.results) });

.byName(name).postItems(data, config) → {Promise.<object>}

Modifies list items in the given list.
Parameters:
Name Type Description
data object the payload
config object the http config
Source:
Returns:
Type
Promise.<object>
Example
var data = {
  __metadata: { type: "SP.Data.AnnouncementsListItem"}
  Title: "listlessly POSTing",
};
sputils.list.byName("Announcements").postItems(data)
  .then(function (data) { console.log(data); });