Lists

Configure SharePoint lists in a web.


Access

Access the Lists API using the lists property of Web.

Examples

up(engineer) {
// Add a list
engineer.web.lists.add('My List');
}

Methods

getById(id)

Get a list by its ID or GUID. We highly recommend using the getByTitle method for any custom lists created by Engineer, as the list ID may change from environment to environment.

Parameters

id
The ID or GUID of the list to be retrieved (String, required)

Returns

List

Examples

up(engineer) {
// Update list by ID
engineer.web.lists.getById('e34fb272-965d-417b-af6b-ef5b5d330205').update({
Description: 'New list description',
});
}

getByTitle(title)

Get a list by its title.

Parameters

title
The title of the list (String, required)

Returns

List

Examples

up(engineer) {
// Update list by title
engineer.web.lists.getByTitle('My List').update({
Description: 'New list description',
});
}

add(options|title)

Add a new list to the target Web.

Parameters

options
New list configuration (Object, required)
title
If a String is provided instead of options, a new list with this title will be created with default configuration (String, override)

Properties of options

BaseTemplate
The base template for this list; see Microsoft’s list template documentation for a listing of all possible values (default: 100) (Number, optional)
Title
A title for the new list (String, required)
Description
A description of the new list (String, optional)
ContentTypesEnabled
Specifies whether content types should be enabled for this list (default: false) (Boolean, optional)
*
See Microsoft’s List resource documentation for a listing of all possible properties that can be passed to the REST API

Examples

up(engineer) {
// Add a simple custom list
engineer.web.lists.add('My Simple List');

// Add a document library
engineer.web.lists.add({
BaseTemplate: 101,
Title: 'My Documents',
Description: 'A library for my documents',
});
}