Skip to content

Getting Started with SharePoint Site Designs and Site Scripts

SharePoint Site Designs and Site Scripts are changing the way end-users interact with SharePoint. These relatively new SharePoint features let users create and deploy a site based on a customized template in just a few clicks. They reduce the time spent on site creation by introducing automation but also help standardize sites based on department or purpose use. If you’re curious about SharePoint Site Designs and Site Scripts and want to get started, read on!

But before we dive in let me take you back a couple of weeks.

SharePoint Sites Made Easy

It was a hot sunny afternoon and I was enjoying grilling burgers for a family gathering, when a thought came to mind: making SharePoint sites (my day job) isn’t all that different from making burgers. Weird, right?

Well, a burger typically contains two base ingredients: a patty and a bun. Past that, it’s all about customization and adding your personalized flavour: condiments, veggies, cheese and additional meat. This is in fact a lot like SharePoint. SharePoint’s base is made up of the Site and its Security Groups, while the individual flavours come from customizable elements like custom content types, custom columns, custom libraries, or custom lists.

As I continued to think about the similarities between making a burger and creating a SharePoint site, I recalled a capability that I used a lot back in SharePoint Server 2007 – SharePoint Server 2010. Those older SharePoint versions allowed you to save a site as a template. It was a relatively straightforward approach that helped jumpstart the site creation process and reduced the redundant configuration tasks of setting up a site. It was like picking up the perfect, customized straight from a production line.

In SharePoint 2007, when you navigated to Site Settings, and clicked the Save Site as a Template an exportable SharePoint Template (STP) file would be available. Whereas in SharePoint 2010, this approach created an exportable Windows SharePoint (WSP) file. Both methods were helpful in deploying packaged functionality to SharePoint. The difference between the two file formats was that Microsoft was moving towards a solution framework for SharePoint 2010 where were kept within a Site Collection gallery rather than in a Farm gallery. But there was a caveat to this templating approach. SharePoint Site Collection required the Publishing site feature to remain deactivated.

Fast forward to SharePoint Online with its Site Designs and Site Scripts. I like to think of them as an alternative to provisioning site artifacts to Modern SharePoint sites. Site Designsare a template of sorts. As of August 2019, you can create a maximum of a 100 Site Designs and 100 Site Scripts in an Office 365 tenant.

What are SharePoint Site Designs and Site Scripts?

A Site Design is created in PowerShell format. It can store multiple Site Scripts that contain sets of configuration actions. Actions or sub actions can involve operations such as creating lists, creating libraries, creating content types, creating columns, calling a flow, joining site to a hub site, and granting users to a security role. They can be selected and applied to a site by a Site Owner. When creating a Site Design, you’ll specify the Title, Description, Thumbnail Picture, and Web template (Team Site or Communication Site).

A Site Script is created in a JSON format. JSON stands for JavaScript Object Notation structures information in a way that’s easy to read at a glance. There are good examples of SharePoint Site Scripts on GitHub. You can review examples and combine them to create your own Site Script. You can also use  third party tools such as Site Designs Studio or SharePoint Site Designer to reduce the complex task to construct a JSON object.

Creating a Site Script

Creating a Site Design and Site Script can be a bit complex as it requires some upfront time to determine what configurable actions you want to perform. Actions are specified by the use of “verb” value. The JSON schema for Site Script is as follows:

  1. {
  2. "$schema": "schema.json",
  3. "actions": [
  4. ...
  5. <one or more verb actions>
  6. ...
  7. ],
  8. "bindata": { },
  9. "version": 1
  10. };
{
    "$schema": "schema.json",
    "actions": [
        ...
        <one or more verb actions>
        ...
    ],
    "bindata": { },
    "version": 1
};

Below is a list of the actions that can be performed:

  1. Creating a new SharePoint list
  2. Add a new site column
  3. Add a new content type
  4. Add a navigation link (on the Quick Launch)
  5. Remove a navigation link (from the Quick Launch)
  6. Apply a theme to the site
  7. Set branding properties
  8. Set a site logo
  9. Join a hub site
  10. Install and add-in or solution
  11. Register an extension
  12. Activate a feature
  13. Trigger a Microsoft Flow
  14. Configure regional settings
  15. Add users to SharePoint Groups
  16. Manage guest access

If your requirements are complex, you can use Microsoft Flow to expand the capabilities of Site Designs and Site Scripts. You can learn more about the syntax on how to apply these actions to your Site Script, by reading the JSON schema reference.

I’ve created a sample below to demonstrate how to construct a Site Script. In my example, this Site Script will contain the following actions and for my use case scenario will be applicable for new sites created for the Information Services department.

  1. Create Custom Site Columns
    • Policy Owner (People Picker)
    • Policy Type (Choice)
    • Policy Expiry Date (DateTime)
  2. Create a Custom Site Content Type
  3. Add the Custom Site Columns to the Custom Site Content Type
  4. Create a Document Library titled as Deliverable Documents
  5. Create a Task List titled Tasks
  6. Create a Calendar List titled Calendar
  7. Add the Custom Site Content Type to the Shared Documents Library
  8. Create a Public View in the Shared Documents Library
  9. Add new links to the Quick Launch
  10. Join the site to a Department’s hub site
  11. Grant one user to the site as an Owner
  12. Grant another user to the site as a Member

Sample Site Script

  1. {
  2. "$schema": "schema.json",
  3. "actions": [
  4. {
  5. "verb": "createSiteColumn",
  6. "fieldType": "User",
  7. "internalName": "PolicyOwner",
  8. "displayName": "Policy Owner",
  9. "isRequired": false,
  10. "group": "DevFacto IS Custom Columns",
  11. "enforceUnique": false
  12. },
  13. {
  14. "verb": "createSiteColumnXml",
  15. "schemaXml": "<Field Type=\"Choice\" DisplayName=\"Policy Type\" Required=\"FALSE\" Format=\"Dropdown\" StaticName=\"PolicyType\" Name=\"PolicyType\"><Default></Default><CHOICES><CHOICE>Policy</CHOICE><CHOICE>Procedure</CHOICE></CHOICES></Field>"
  16. },
  17. {
  18. "verb": "createSiteColumn",
  19. "fieldType": "DateTime",
  20. "internalName": "PolicyExpiryDate",
  21. "displayName": "Policy Expiry Date",
  22. "isRequired": false,
  23. "group": "DevFacto IS Custom Columns"
  24.  
  25. },
  26. {
  27. "verb": "createContentType",
  28. "name": "Policy",
  29. "description": "Policy Document",
  30. "parentName": "Document",
  31. "hidden": false,
  32. "subactions":
  33. [
  34. {
  35. "verb": "addSiteColumn",
  36. "internalName": "PolicyOwner"
  37. },
  38. {
  39. "verb": "addSiteColumn",
  40. "internalName": "PolicyType"
  41. },
  42. {
  43. "verb": "addSiteColumn",
  44. "internalName": "PolicyExpiryDate"
  45. }
  46. ]
  47. },
  48. {
  49. "verb": "createSPList",
  50. "listName": "Deliverable Documents",
  51. "templateType": 101,
  52. "subactions": [
  53. {
  54. "verb": "setDescription",
  55. "description": "Project team can use this Deliverable Documents Library to store deliverable documents."
  56. }
  57. ]
  58. },
  59. {
  60. "verb": "createSPList",
  61. "listName": "Tasks",
  62. "templateType": 107,
  63. "subactions": [
  64. {
  65. "verb": "setDescription",
  66. "description": "Use the Tasks list to monitor and manage tasks within the Project."
  67. }
  68. ]
  69. },
  70. {
  71. "verb": "createSPList",
  72. "listName": "Calendar",
  73. "templateType": 106,
  74. "subactions": [
  75. {
  76. "verb": "setDescription",
  77. "description": "Use the Calendar list to track upcoming events and deadlines relevant to the Project."
  78. }
  79. ]
  80. },
  81. {
  82. "verb": "createSPList",
  83. "listName": "Documents",
  84. "templateType": 101,
  85. "subactions": [
  86. {
  87. "verb": "addContentType",
  88. "name": "Policy"
  89. },
  90. {
  91. "verb": "addSPView",
  92. "name": "By Policies",
  93. "viewFields":
  94. [
  95. "Name",
  96. "PolicyOwner",
  97. "PolicyType",
  98. "PolicyExpiryDate",
  99. "Modified",
  100. "Editor",
  101. "Version"
  102. ],
  103. "query": "<OrderBy><FieldRef Name=\"Name\" Ascending=\"FALSE\" /></OrderBy><GroupBy Collapse =\"TRUE\"><FieldRef Name =\"PolicyType\"/></GroupBy><Where><Eq><FieldRef Name=\"ContentType\"/><Value Type=\"Computed\">Policy</Value></Eq></Where>",
  104. "rowLimit": 100,
  105. "isPaged": true,
  106. "makeDefault": false
  107. }
  108. ]
  109. },
  110. {
  111. "verb": "addNavLink",
  112. "url": "/Deliverable%20Documents",
  113. "displayName": "Deliverable Documents",
  114. "isWebRelative": true
  115. },
  116. {
  117. "verb": "addNavLink",
  118. "url": "/Lists/Tasks",
  119. "displayName": "Tasks",
  120. "isWebRelative": true
  121. },
  122. {
  123. "verb": "addNavLink",
  124. "url": "/Lists/Calendar",
  125. "displayName": "Calendar",
  126. "isWebRelative": true
  127. },
  128. {
  129. "verb": "joinHubSite",
  130. "hubSiteId": "18414d04-6d98-4295-a3e7-b92528130e5b",
  131. "name": "Information Services"
  132. },
  133. {
  134. "verb": "addPrincipalToSPGroup",
  135. "principal": "adam.tobias@devfacto.com",
  136. "group": "Owners"
  137. },
  138. {
  139. "verb": "addPrincipalToSPGroup",
  140. "principal": "nameofsecuritygroup@devfacto.com",
  141. "group": "Owners"
  142. },
  143. {
  144. "verb": "addPrincipalToSPGroup",
  145. "principal": "nameofuser@devfacto.onmicrosoft.com",
  146. "group": "Members"
  147. }
  148. ],
  149. "bindata": { },
  150. "version": 1
  151. }
{
    "$schema": "schema.json",
        "actions": [
            {
                "verb": "createSiteColumn",
                "fieldType": "User",
                "internalName": "PolicyOwner",
                "displayName": "Policy Owner", 
                "isRequired": false,
                "group": "DevFacto IS Custom Columns",
                "enforceUnique": false
            },
            {
                "verb": "createSiteColumnXml",
                "schemaXml": "<Field Type=\"Choice\" DisplayName=\"Policy Type\" Required=\"FALSE\" Format=\"Dropdown\" StaticName=\"PolicyType\" Name=\"PolicyType\"><Default></Default><CHOICES><CHOICE>Policy</CHOICE><CHOICE>Procedure</CHOICE></CHOICES></Field>"
            }, 
            {
                "verb": "createSiteColumn",
                "fieldType": "DateTime",
                "internalName": "PolicyExpiryDate",
                "displayName": "Policy Expiry Date",
                "isRequired": false,
                "group": "DevFacto IS Custom Columns"
                
            },
            {
                "verb": "createContentType",
                "name": "Policy",
                "description": "Policy Document",
                "parentName": "Document",
                "hidden": false,
                "subactions":
                [
                    {
                        "verb": "addSiteColumn",
                        "internalName": "PolicyOwner"
                    },
                    {
                        "verb": "addSiteColumn",
                        "internalName": "PolicyType"
                    },
                    {
                        "verb": "addSiteColumn",
                        "internalName": "PolicyExpiryDate"
                    }
                ]
            },
            {
                "verb": "createSPList",
                "listName": "Deliverable Documents",
                "templateType": 101,
                "subactions": [
                    {
                        "verb": "setDescription",
                        "description": "Project team can use this Deliverable Documents Library to store deliverable documents."
                    }
                ]
            },
            {
                "verb": "createSPList",
                "listName": "Tasks",
                "templateType": 107,
                "subactions": [
                    {
                        "verb": "setDescription",
                        "description": "Use the Tasks list to monitor and manage tasks within the Project."
                    }
                ]
            },
            {
                "verb": "createSPList",
                "listName": "Calendar",
                "templateType": 106,
                "subactions": [
                    {
                        "verb": "setDescription",
                        "description": "Use the Calendar list to track upcoming events and deadlines relevant to the Project."
                    }
                ]
            },
            {
                "verb": "createSPList",
                "listName": "Documents",
                "templateType": 101,
                "subactions": [
                    {
                        "verb": "addContentType",
                        "name": "Policy"
                    },
                    {
                        "verb": "addSPView",
                        "name": "By Policies",
                        "viewFields": 
                        [
                            "Name", 
                            "PolicyOwner",
                            "PolicyType",
                            "PolicyExpiryDate",
                            "Modified",
                            "Editor",
                            "Version"
                        ],
                        "query": "<OrderBy><FieldRef Name=\"Name\" Ascending=\"FALSE\" /></OrderBy><GroupBy Collapse =\"TRUE\"><FieldRef Name =\"PolicyType\"/></GroupBy><Where><Eq><FieldRef Name=\"ContentType\"/><Value Type=\"Computed\">Policy</Value></Eq></Where>",
                        "rowLimit": 100,
                        "isPaged": true,
                        "makeDefault": false
                    }
                ]
            },
            {
                "verb": "addNavLink",
                "url": "/Deliverable%20Documents",
                "displayName": "Deliverable Documents",
                "isWebRelative": true
            },
            {
                "verb": "addNavLink",
                "url": "/Lists/Tasks",
                "displayName": "Tasks",
                "isWebRelative": true
            },
            {
                "verb": "addNavLink",
                "url": "/Lists/Calendar",
                "displayName": "Calendar",
                "isWebRelative": true
            },
            {
                "verb": "joinHubSite",
                "hubSiteId": "18414d04-6d98-4295-a3e7-b92528130e5b",
                "name": "Information Services"
            },
            {
                "verb": "addPrincipalToSPGroup",
                "principal": "adam.tobias@devfacto.com",
                "group": "Owners"
            },    
            {
                "verb": "addPrincipalToSPGroup",
                "principal": "nameofsecuritygroup@devfacto.com",
                "group": "Owners"
            }, 
            {
                "verb": "addPrincipalToSPGroup",
                "principal": "nameofuser@devfacto.onmicrosoft.com",
                "group": "Members"
            }
        ],
            "bindata": { },
    "version": 1
}

 

Associate Site Script with Site Design

Next, we’ll need to then associate this to a Site Design. To do so, we can create Site Design and associate the Site Script by executing the PowerShell below:

 

  1. $siteScriptFile = "\SiteScripts\IS-SiteScript.json"
  2. # Source path where you stored your Site Scripts
  3. $webTemplate = "64"
  4. #64 = Team Site, 68 = Communication Site, 1 = Groupless Team Site
  5. $siteScriptTitle = "IS Project Site Script"
  6. $siteDesignTitle = "IS Project Site Design"
  7. $siteDesignDescription = "IS project site design with Content Types, Site Columns, additional libraries, lists, and creation of folders."
  8. $previewImageUrl = "" # can be left blank or you can add a custom image.
  9. $siteScript = (Get-Content $siteScriptFile -Raw | Add-SPOSiteScript -Title $siteScriptTitle) | Select -First 1 Id
  10.  
  11. Add-SPOSiteDesign -SiteScripts $siteScript.Id -Title $siteDesignTitle -WebTemplate $webTemplate -Description $siteDesignDescription
$siteScriptFile = "\SiteScripts\IS-SiteScript.json"
# Source path where you stored your Site Scripts
$webTemplate = "64" 
#64 = Team Site, 68 = Communication Site, 1 = Groupless Team Site
$siteScriptTitle = "IS Project Site Script"
$siteDesignTitle = "IS Project Site Design"
$siteDesignDescription = "IS project site design with Content Types, Site Columns, additional libraries, lists, and creation of folders."
$previewImageUrl = "" # can be left blank or you can add a custom image.
$siteScript = (Get-Content $siteScriptFile -Raw | Add-SPOSiteScript -Title $siteScriptTitle) | Select -First 1 Id

Add-SPOSiteDesign -SiteScripts $siteScript.Id -Title $siteDesignTitle -WebTemplate $webTemplate -Description $siteDesignDescription 

 

If successful, the console will return the following result:

 

Console result for Associating Site Script with Site Design

 

Now that we have our Site Design and Site Script deployed in our Office 365 tenant, it can be programmatically executed by a user through PowerShell or REST. Users can create a new site by clicking Create Site and then selecting the right design.

 

Creating a new site in SharePoint based on Site Designs

 

Users can also apply the newly built site design to an existing site. To do so, the user would navigate to the site, click on the Settings icon on the top right corner, and click Site Designs.

 

Settings Menu in SharePoint Site design

 

A Site Design pane will appear on the right side of the screen showing you all the available site designs. Select a Site Design you want to apply to the existing site.

 

 

Then, click the Apply to Site button.

 

Available Site Dsigns - Progress Status

 

After clicking the Apply to site button, a progress bar will appear letting the user know what action was completed, is pending, or in the queue to perform.

 

IS Project Design Progress Bar

 

When all the actions are completed, the end user can click View updated site.

 

IS Project Site Desgin - Progress Bar Complete - SharePoint

 

The user will be directed to the updated site with configured actions applied from the Site Script that is associated to the chosen Site Design.

 

SharePoint Modern Site -Site Design

 

Another option mentioned earlier would be calling the Site Design programmatically through REST. Below is an example in Microsoft Flow using the Send an HTTP request to SharePoint action.

 

Microsoft Flow - Apply IS Site Design

 

This approach also makes it possible to restrict the users that can select and apply site designs to a site. Whether it’s a governance requirement or a security concern, whatever the reason may be, you can scope the Site Design to include defined users or security groups.

 

  1. $adminSiteUrl = "https://tenant-admin.sharepoint.com"
  2. $siteDesignId = " 8245449c-9d0f-4311-b2dc-8dcb2483cb01"
  3. $principals = "Security Group Name", "user@mytenant.onmicrosoft.com"
  4. $cred = Get-Credential
  5. Connect-SPOService $adminSiteUrl -Credential $cred
  6. Grant-SPOSiteDesignRights -Identity $siteDesignId -Principals $principals -Rights View
  7. Get-SPOSiteDesignRights -Identity $siteDesignId
$adminSiteUrl = "https://tenant-admin.sharepoint.com"
$siteDesignId = " 8245449c-9d0f-4311-b2dc-8dcb2483cb01"
$principals = "Security Group Name", "user@mytenant.onmicrosoft.com"
$cred = Get-Credential
Connect-SPOService $adminSiteUrl -Credential $cred
Grant-SPOSiteDesignRights -Identity $siteDesignId -Principals $principals -Rights View
Get-SPOSiteDesignRights -Identity $siteDesignId

 

Why use SharePoint Site Designs and Site Scripts?

So, you’re probably asking yourself what are the advantages and disadvantages of Site Designs/Site Scripts? Let’s take a look below.

Benefits of using Site Designs and Site Scripts

  • They reduce time spent on effort intensive tasks by introducing automation
  • Once the Site Design and/or Site Script is published in your organization, the Site Champions or SMEs of the sites can apply it to their site. This means less time needed to configure a site.
  • The progress bar notifies the user about the stage the site provisioning is at. This is a better user experience than the past ‘Save site as a template’ approach.
  • Allows to define Site Designs/Site Scripts that have been configured by your IT personnel.
  • It can be re-applied to a site multiple times to ensure site is up to date to the latest Site Design/Site Script.
  • Allow to restrict a user or group that can see a Site Design/Site Script.
  • Allow the action to trigger Flow and expand from the limited actions.
  • Help standardize sites based on department use or purpose use.

Disadvantages

  • To create a Site Script, you’ll need to learn or understand JSON.
  • To create a Site Design, you’ll need to learn or understand PowerShell.
  • Depending on the IT policies in your organization, you might not be able to follow what was discussed in this blog post. You may need to consult your IT Administrator about setting up Site Scripts and Site Designs.
  • No out of the box user interface for a non-IT users to build Site Designs/Site Scripts.
  • Limited actions to handle complex provisioning needs.
  • Unable to create managed metadata columns that connect to the Term Store Management.

In conclusion, Site Designs/Site Scripts don’t replace SharePoint CSOM or PowerShell PnP, but rather bring another option to the table. You’ll need to determine if Site Designs and Site Scripts are right for your organization based on your requirements and how your organization addresses creating and applying changes to a site.

Personally, I think Site Designs and Site Scripts are quite powerful and love how the wizard-like interface makes it easy for users to apply to a new or existing site for easier adoption. The only thing that would make it better is a similar wizard-like experience for the creating Site Designs and Site Scripts. That way, users wouldn’t need to create JSON schema files for the Site Script and use PowerShell for the deploying of the Site Design.

I hope this post provided you with insights about the value of Site Designs and Site Scripts. If you would want to learn more about this topic, I’d love to chat over a perfect burger. Cheers!