Latest Guide to SharePoint Side Design and Site Script

Beyond Key
Beyond Key
Published in
5 min readSep 26, 2022

There are several scenarios where it requires to create a site with a similar list, library, or design. For example, if there is a requirement to create sites for multiple departments, and you also want some identical lists and the same design. What will you do in that case? This blog will answer these queries.

Setting up a site exactly how you intended it to be and saving it as a template was perhaps one of the most common ways to build out SharePoint sites, even though it was limited to classic team sites.

The option to save the site as a template is no longer available in modern SharePoint sites. To handle these scenarios in the modern SharePoint, you can use site scripts and design features.

SharePoint Side Design and Site Script

What is Site Design and Site Script?

Site Design is used to create new sites with Modern UI. All the actions mentioned in the site scripts get executed on applying the site design. It enhances the consistency across the site collection within the tenant. Using site designs, we can create lists, libraries, content types and set themes, site logos, etc. A site design is like a container for the site script; we can attach multiple scripts to a site design.

Site Script is JSON files. In this script file, actions are listed. All the listed actions will execute when Site Design is applied to an existing site. No UI is available to work with Site Scripts; users must work with PowerShell.

Site Script can run multiple times on the same site. Site Scripts are not similar to templates associated with the sites. Changes you made in the site designs will not reflect on the sites automatically. You need to apply the changed site design again on the sites.

Currently, we can include the following actions in the site script:

  • Create a list or library (or alter the default one created with the site)
  • Create the site columns and content types, and configure other list settings
  • Set site branding properties, such as navigation layout, header layout, and header background
  • Apply a theme
  • Setting a site logo
  • Add links to quick launch or hub navigation
  • Triggering a Microsoft Flow
  • Install a deployed solution from the app catalog
  • Set regional settings for the site
  • Include principals (users and groups) in SharePoint roles
  • Setting external sharing capability for the site

To create a site script, you must prepare the JSON, parameters, and verbs. You can copy-paste verbs in JSON files from JSON Schema to change the parameter value. Some tools are also available to create a JSON schema. You can use those tools to prepare your JSON script.

Note:

  • Site templates and site scripts are currently only supported by SharePoint Online.
  • Site template version history is not currently available.

Limitations:

  • Only includes thirty actions per site. This limitation will remain for the scripts applied synchronously, but it increased to 300 actions 0r 1,00,000 characters for the script applied asynchronously or using UI/commands.
  • Limit for the 100 site scripts and 100 site designs per tenant.

Create a new Site Design and Site Script

  • Create one JSON file; for this blog, I am creating a file named “SiteScriptDemo.json .” After creating a file, put all the actions you want to insert with the parameter and the verbs.

Add a Site Script to the tenant

Open the SharePoint online management shell and connect with the tenant using the admin URL. Replace *** with your domain.

Step 1: Connect-SPOService -Url https://*** -admin.sharepoint.com

Step 2: Get-Content “D:/SiteScriptDemo.json” -Raw | Add-SPOSiteScript -Title “DptSiteTemplate”

Provide the file path from your machine, and you can give the template name per your requirement. Copy the Id you get from step two for future reference.

Step 3: Add-SPOSiteDesign

It will prompt you with some questions on the console.

  • Title — Put the title name according to you.
  • WebTemplate — 64 (If you are creating this for the team site, use 64, or if you are creating this for the communication site, use 68)
  • SiteScript[0] — Paste the script id generated in step 3

Apply the site template on the site

  • Login to your SharePoint tenant.
  • Navigate to the site where you want to apply the site template.
  • Go to the site settings and Click on the Apply a site template.
SharePoint Site Settings
  • It will prompt a window to Select a template and select the “From Your Organization” option.
SharePoint Select a Template

· When you click on from your organization, it will show you all the available site templates you have added to the site. Select the template which you want to apply.

SharePoint Select a Template Design

· Select the template, and it will preview all the actions it will do. Now click on the “Use template.”

Apply SharePoint Templates

· Great. All the changes will appear on your site.

Conclusion

In this blog, we discussed SharePoint Site Designs and Site Scripts. Site Designs and Site Scripts are effortless to implement, and it helps reduce our effort when we need to create sites with the same structure, design, and configuration across the SharePoint tenant.

We also discussed the essential things to know for adding the Site design and Site Scripts. In an organization, many scenarios come across where it is required to replicate structure or create similar things. In such situations, it’s good to have something which saves time and effort, Site Scripts and Site Design is the best option.

--

--

Beyond Key
Beyond Key

Beyond Key is a Microsoft Solutions Partner company serving clients globally.