Protiviti / SharePoint Blog

SharePoint Blog

April 13
Office 365 Site Scripts – Site Provisioning made easy

In the last couple months, Microsoft has introduced a new feature to Office 365 called Site Scripts. They are, basically, a representation of steps to perform automatically after a site has been created.

What this means is you can automate boilerplate steps for creating sites like creating lists, adding content types to the lists, tweak navigation elements, execute a Flow and tap into Azure Functions to do some heavy lifting for provisioning new sites. You can even set a new site theme automatically.


The site script itself is a JSON structure representing steps called “verbs”. Below is an example of a site script that on site creation, it creates a list called “Customer Tracking” and adds a handful of columns to this list.


Really straightforward process. You can view more details on the actions and verbs here:

Once you have a JSON structure of a site script, you then add it to your tenant via PowerShell. Make sure you have the latest SharePoint Online Management Shell as these are new features. Ensure you remove any previous versions as they will conflict.

The two commands are:

$SiteScript = Add-SPOSiteScript -Title "Create customer tracking list" -Content $siteScriptJSON -Description "Creates list for tracking customer contact information"

Add-SPOSiteDesign -Title "Contoso customer tracking" -WebTemplate "64" -SiteScripts $SiteScript -Description "Tracks key customer data in a list"

The first command adds the script to the tenant itself. The second command allows the script to be used.

Once the script is added and as a site design, you can go and create a site using the new template. After the site is created, you should see your script execute checking off items in a pane on the right as it completes.

As with any new feature Microsoft is adding more abilities to these site scripts so stay tuned.

Quick Launch

© Protiviti 2021. All rights reserved.   |   Privacy Policy