What is a Site Design?
Site designs and site scripts provide the ability to automate provisioning of Modern SharePoint sites. Site designs are like templates. They can be used each time a new site is created to apply a consistent set of actions
Site Design PowerShell Options
Creates a new site design available to users when they create a new site from the SharePoint home page
This invocation is limited to 30 actions within the site scripts associated with the site design
This command is used to apply a site design to a specific site collection. This command is intended to replace Invoke-SPOSiteDesign and is useful when you need to apply a large number of actions or multiple site scripts.
This invocation allows for 300 actions or 100k characters within the site scripts associated with the site design
Call unlimited number of actions within a Site Design?
Call Microsoft Flow from a Site Script enables custom solutions to apply configurations not supported by site designs.
The Concept:
The REST API endpoint for calling Site Design Tasks is as follows:
_api/Microsoft.Sharepoint.Utilities.WebTemplateExtensions.SiteScriptUtility.AddSiteDesignTaskToCurrentWeb
The base site design will trigger Microsoft Flow (tutorial for creating site design to call Microsoft Flow) which in turn will utilize the “send an HTTP request” action within Flow to call the REST API endpoint for calling the site design task.
The Flow can then call multiple site design tasks (fusing site designs together)
This concept of fusing(calling) multiple site design tasks (each site design task supports up to 300 actions or 100k characters) within Flow enables virtually unlimited site script actions
The Solution:
Call Site Designs in Order:
The Site Design Task HTTP action executed via Flow only creates the request to execute the site design. If site designs are dependent on assets created by another site design – for example “Site Design 2” is dependent on assets in “Site Design 1” – then there is a need to check the status of “Site Design 1” prior to calling “Site Design 2”
To check on the status of a site design task job or to view details of the scheduled run, the PowerShell command is as follows:
Get-SPOSiteDesignRunStatus
The REST API endpoint for checking site design task run status is as follows:
_api/microsoft.sharepoint.utilities.webtemplateextensions.sitescriptutility.getsitedesignrunstatusandschema
The Site Design Run status API requires the “runId” parameter which is obtained by the “ID” property of the add Site Design Task REST API call
Special thanks to Beau Cameron for providing context to the REST API endpoints for Site Design Tasks – Beau’s Blog
Thanks for reading !!!