Most of my articles these days center around information security and compliance. But I’m an Office 365/SharePoint Online fan as-well 🙂 And sometimes I feel the need to share some information on those platforms, which I think deserves more attention. And this is one of these…..
In the December 2018 SharePoint roadmap “pitstop” Microsoft announced many new enhancements for SharePoint Online. One of these is the use of so-called site designs. These designs are not new. The basic format was introduced at the end of 2017.
But what is new is the way your site-owners can start using them. Now site-owners can easily apply site designs from the user interface. Which makes it very easy and user-friendly. Enabling this function was part of this roadmap item.
But let’s take one step back and look at the site designs themselves.
Site designs and site scripts
Like I said earlier, some time ago Microsoft rolled out the site design and site scripts options. These options (only available for modern teamsites and communication sites) allow administrators to create custom site templates or part of sites. For example: a specific setting (see below), custom columns or entire parts of a site.
There are two parts for this solution. One is the site design. The site design is the template your site-owners can select and use. It has a title, description and also one or more site scripts to be applied. It also contains a reference to the out of the box templates this site design can be applied to. This last option is called “Webtemplate” – 64 is the modern teamsite and 68 is the communication site.
Part of the site design is the site script. This site script is in effect JSON code, which contain the parts of the template. This example script will add the site to a designated hubsite.
{“$schema”: “schema.json”,“actions”: [{“verb”: “joinHubSite”,“hubSiteId”: “a06b3457-ec72-4e91-8f1d-6b583380e39f”,“name”: “Intranet Home”}],“bindata”: { },“version”: 2}
Two important notes
Although the new site designs and site scripts are very powerful, you might need to go beyond the possibilities of these functions. And you can do just that using Microsoft Flow. Within the site script you can trigger a Flow to complete any additional actions. For more information on this, please read this article.
Another thing that will come in handy is the ability to scope the site designs. A scope defines who can use the site design. This scope is based on the identity of the site design (see below) and is provided to specific users or security groups.
The required PowerShell cmdlet for this:
Grant-SPOSiteDesignRights -Identity “site design id” -Principals “users or security group” -Rights “view”
For more information on this, please read this article.
PowerShell
Site designs and site scripts are created on tenant level and by using PowerShell. You will need the latest SharePoint Online module for this. The site script itself can be part of the PowerShell cmdlets or you can use a JSON file for this. Let’s take a look at creating the script.
In my example I’ve used an example script from Github. It’s the script I showed you before. When used, it will add the site to a hubsite call Intranet Home. The hubsite ID can be easly found when using the get-SPOHubsite cmdlet.

Now that I’ve got the contents of the script, I need to add this to my tenant. And for this I use the Add-SPOSiteScript cmdlet. This cmdlet needs a title, description and the content for the script. When finished, it will provide me with a script-id.

The script has now been added to my tenant. By the way, if you want to know which scripts have been added, just use the Get-SPOSiteScript cmdlet.
The script now needs to be added to a site design. For this I use the Add-SPOSiteDesign cmdlet. This cmdlet will need to script-id and the webtemplate number (64: modern teamsite, 68: communication site).

The site design has now been added to my tenant. By the way, if you want to know which designs have been added, just use the Get-SPOSiteDesign cmdlet.
In-action
Now it’s time to see this in action. For this I’ve created an out-of-the-box SharePoint modern teamsite. This site has not been connected to a hubsite.

From the settings-menu I can now select the Site designs option.

This shows me the current site designs. As you might notice, I’ve tested several already.

I select the Connect to hubsite option. I get an overview of the actions to be taken. In this case it’s not a very long list. It will just connect the site to my Intranet Home hubsite. When finished I see the relevant notification.


But let’s check to see if this really worked. And presto: my teamsite is now connected to my hubsite.

Other options
This example is very easy and shows the ease of this option. The power of this function will become clearer when you start working with creating components for sites (like lists and columns) and combining them to form a real site-template.
When you go to the Site designs option again, you will see all the designs which have been added to the site.

If you need to update a specific script, you can use the “set-SPOSiteScript” cmdlet. See the comments for this. If you need to update a specific site design, you can do so. You use this PowerShell cmdlet for this:
set-SPOSiteDesign -identity “site design id” -title “Title of the site design”
You then will have to ask your site-owners to apply the new site design or use PowerShell to apply them.
More information?
If you want more information of this function, please follow the links below. Github also provides several sample JSON scripts and I would recommend looking at these. Like I did for this article 🙂
Have you tried re-applying a Site Design with a CreateSPList action? The list duplicates instead of updating. Is that by design?
Hi Mike,
I’ve tried this myself. What I did was the following:
1. I updated the JSON code;
2. Then I used this code to update the site design script using “Set-SPOSiteScript -Title -Identity -content <the updated JSON script" -Description
In this test it worked perfectly. The updates I did:
a. I modified the description of a list;
b. I added my own view
According to Microsoft (https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/set-spositescript?view=sharepoint-ps) this is the only action needed to update a site-design. And this did the trick for me.