Learn to simplify the onboarding process with this web seminar “Allow It To Be Easy! Office 365 and SharePoint Worker On/Off-boarding” today!
Modern SharePoint sites convey more happening underneath the hood than you would think. Both SharePoint Site Designs and Scripts are utilized to automate the provisioning of contemporary sites. With such template technologies, site creators can make sure that sites are created with consistent branding, theming, and general structure. Once deployed, users may then select what design they would like to affect their website during provisioning.
The Website Scripts and Designs are produced in JSON format and wish a particular degree of technical understanding. Once ready, they should be deployed in to the Microsoft 365 tenant using PowerShell or REST API to allow them to be leveraged by other users. This last step is usually done by someone within the IT department because it requires elevated permissions. Each time a template must change, the entire process of updating the JSON files and deploying the templates must be repeated.
In the following paragraphs, we’ll review how you can use a Site Script by automating the deployment part using SharePoint and Power Automate. It can also be easily expanded to incorporate Site Designs, permissions, along with other customizations!
Handling the Site Design and Scripts
The information element of the answer is a straightforward SharePoint list which contains the next fields:
- Title – Single type of text
- Site Design ID – Single type of text
- Site Script ID – Single type of text
- Site Script Content – Multiple lines of text (plain text)
- Site Version – Number
To produce a new Site Design and Script, all of the user must do is give a title and Script content within the proper JSON format. The Website Design, Site Script, and script version IDs are instantly populated through the workflow described below. (NOTE: Permissions for this list ought to be restricted to only template creators).
When the user is able to create the new or updated Site Design, they simply choose the item that they would like to create the template after which call the ability Automate flow.
Automating the Deployment Process
The flow is mainly in line with the Microsoft.SharePoint.Utilities.WebTemplateExtensions.SiteScriptUtility REST API library:
Figure 2 depicts part one, where the flow checks to find out if a website Script ID is empty or otherwise. If it’s (begin to see the “If yes” branch), then your CreateSiteScript API is known as and also the Site Script submissions are provided. Otherwise, the UpdateSiteScript API is known as:
The following part portrayed in Figure 3 shows exactly the same check is conducted, as well as the Site Design ID. Exactly the same logic is used either to create or update the website Design:
As pointed out earlier, this situation isn’t a complete exhaustive workflow that handles all scenarios for that Site Design and Script provisioning, but instead is supposed to showcase how the procedure may be easily automated using SharePoint and Power Automate. Easy enhancements include separating the website Scripts and Designs into separate lists, recording the script versions and permissions, and much more.