Webs

Configure SharePoint webs in a parent web.


Access

Access the Webs API using the webs property of a parent Web.

Examples

up(engineer) {
// Add a new web/subsite
engineer.web.webs.add('My Web');

// Add another web to the new web (above)
engineer.getWeb('/my-web').webs.add('Another Web');
}

Methods

add(options|title)

Add a new web to the target parent Web.

Parameters

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

Properties of options

Title
A title for the new web (String, required)
Url
The URL or web address of the new web (relative to the parent web URL); if this is not provided, a new URL will be automatically generated based on the contents of the Title property (String, optional)
WebTemplate
The SharePoint web template to be used when creating the new web; see this blog post for a listing of all templates (default: "STS") (String, optional)
Description
A description of the new web (String, optional)
Language
The locale ID for localization of SharePoint content; see Microsoft’s locale ID documentation for a listing of all possible values (default: 1033) (Number, optional)
*
See Microsoft’s Web resource documentation for a listing of all possible properties that can be passed to the REST API

Examples

up(engineer) {
// Add a new web/subsite
engineer.web.webs.add('My Web');

// Add publishing site to new web
engineer.getWeb('/my-web').webs.add({
Title: 'A New Web',
Url: 'a-new-web',
WebTemplate: 'CMSPUBLISHING',
});
}