Site designs and Site scripts
This week—Microsoft started rolling out a new feature called Site designs and Site scripts to its Office 365 customers. With Site designs and Site scripts—SharePoint admins can create and upload custom site templates and users can use these during the Out Of the Box site creation process. This new feature will only be available for the the Modern sites (Modern Team sites and Communication sites).
A Site script is a JSON file, describing the customisations which needs be added to an out of the box site. A Site script is uploaded to a gallery at tenant level. A Site design is the actual template you define. For instance a ‘Finance site’. Through a PowerShell cmdlet, you are able to define a Site design, which is always based on an Out Of the Box template. A Site design can be added in the following way:
Add-SPOSiteDesign -Title "Finance site" -WebTemplate "64" -SiteScripts "<ID>"
-Description "Finance department site"
A Site design will always reference one or more Site scripts in Order to apply the customisations defined in the Site script. WebTemplate 64 stands for a Modern Team site. 68 stands for a Modern Communication site.
When you Add a Site script using below cmdlet, you will retrieve an ID which should be used above:
Add-SPOSiteScript -Title "Create finance lists and customizations" -Content $site_script -Description "Creates lists for Finance site"
The $site_script should contain the JSON string.
More information on creating and managing Site designs and Site scripts can be found at the PnP Guidance site.
What does this mean for the end user?
Before the availability of Site designs and Site scripts—there was no easy way to deliver an easy user experience to end users—for creating custom sites. There was no way to customise the Out Of the Box site creation process—other then redirect a user to a custom form. With Site designs we get the possibility to use the Out of the Box site creation proces and choose our custom defined Site design. The Site script defined for the Site design will be post processed after the defined Out Of the Box WebTemplate site is created. This way we can add custom lists, add content types, set custom theme, etc. to our sites. We can even trigger a Microsoft Flow in order to do extra customisations (using PnP templates) when the Site script doesn’t support the customisation. For a complete list of customisations available with Site scripts, read the PnP guidance site about the JSON schema.
Scoping Site designs
A Site design can be scoped to a certain User of User group. This way we can deliver certain Site designs to specific users or a group of users. This gives us better control on which sites a user can create. The scoping can be done on User level or at Security group level (mail-enabled Security group). More information about scoping Site designs can be found at the PnP Guidance site.
Calling the PnP provisioning engine using Microsoft Flow
One of the nice features of the Site script in my opinion—is the option to trigger a Microsoft Flow. This way we can use custom code and use the PnP provisioning engine in order to support customisations not available using Site scripts. Below an overview how this process would look like:
Where we would have used a SharePoint list, Azure Webjobs (scheduled) and the PnP engine—we are now able to deliver this using the Out Of the Box site creation process.
More information about calling the PnP provisioning engine from a Site script can be found at the PnP Guidance site.
With the new features of Site designs and Site scripts we can deliver custom site templates to our users using the Out Of the Box site creation process. SharePoint tenant administrators can control which Site designs and Site scripts are available in the tenant and can scope these to users or groups of users. Less development is necessary in order to support custom site creation processes using Site designs and Site scripts.
Do you want more information about Site designs and Site scripts and how this can be implemented within your organisation?
Feel free to contact me at firstname.lastname@example.org
Original article was posted on: https://robertschouten.com/2017/12/13/sharepoint-online-site-designs-and-site-scripts/