BLUESITE IT Consultancy

How do I upload a SharePoint template?

In SharePoint in Microsoft 365 you apply a custom or third-party template by selecting ‘From your organization’. This article guides you to bring your SharePoint template exactly there in SharePoint dialog Select a template, From your organization.

SharePoint Online site template in Microsoft 365
Figure - SharePoint Online site template in Microsoft 365

About SharePoint templates

Since May 2021 SharePoint in Microsoft 365 offers new site templates and the technology of SharePoint templates changed. A SharePoint template today is in fact a script, creating and changing content and design, after a SharePoint site has been created. You can apply a SharePoint template - run the site script - even on existing SharePoint team websites. The script is a human-readable JSON file. You upload it together with a thumbnail picture, a title, and a description to SharePoint in Microsoft 365.

Template title and description

When you upload the SharePoint template (JSON file, plus optional content) you should give it a title, a description, and a thumbnail. It´s useful for you to understand what´s shown where after you uploaded. Custom or third-party templates are shown on Select a template under From your organization.

Add-SPOSiteDesign -ThumbnailUrl
You can display here a picture of how the SharePoint site will look after you applied the template. This picture must be a PNG file, at least 400x300 pixel dimensions. You need to upload the PNG file before you upload the script and provide the website address of the file (URL).

Add-SPOSiteDesign -Title
Just a plain text without formatting, ex. “Quality management”.

Add-SPOSiteDesign -Description
Again, just plain text without any formatting, ex. “Define system scope and processes, track risks and actions, and collaborate for evaluation and improvement”.

SharePoint template Add-SPOSiteDesign parameters match
Figure - SharePoint template Add-SPOSiteDesign parameters match

You also need to give the JSON script a title (‘Add-SPOSiteScript -Title’), and optionally a description. The documented PreviewImageUrl and PreviewImageAltText parameter for the preview, when you click on the template won´t work.

👍 See how it works Apply a SharePoint Quality Management site template
You´ll find your own template in category 'From your organization'.

How to upload a SharePoint site template in Microsoft 365

About 8 minutes. You need a Microsoft 365 subscription, and anSharePoint site script (JSON file).

Download and install the SharePoint Online Management Shell

Uninstall any previews version of SharePoint Online Management Shell. Download the latest version from www.microsoft.com, and install it on your Windows PC.

Download SharePoint Online Management Shell from Microsoft Download Center and install it on your Windows PC
Figure - Download SharePoint Online Management Shell from Microsoft Download Center and install it on your Windows PC

Evaluate the URL of your SharePoint Online Administration Center site

Sign in to www.office.com using a Global administrator account. In the App launcher click on Admin. Left hand side in the navigation menu click on Show all. Under Admin center click on SharePoint. Note the Admin-URL (everything left of /_layouts/…), ex. https://msft-admin.sharepoint.com

SharePoint Admin center link in Microsoft 365 admin center
Figure - SharePoint Admin center link in Microsoft 365 admin center

Upload the Thumbnail picture and evaluate SharePoint Online URL

In the App launcher click on SharePoint. Top right hand click on Settings and on Site contents. Under column Name click on Site Assets. In the menu click on Upload and on File. Select your Thumbnail PNG file, ex. “QMSListsThumbnail.png” and click on Open. Note the SharePoint-URL (everything left of /SiteAssets/…), ex. https://msft.sharepoint.com

Upload thumbnail image for SharePoint site template
Figure - Upload thumbnail image for SharePoint site template

Connect to SharePoint Online using PowerShell

Start the Windows PowerShell ISE. Type “Connect-SPOService -Url https://msft-admin.sharepoint.com” using Admin-URL and sign in using a SharePoint administrator (or Global administrator) account.

Connect to SharePoint Online using PowerShell in ISE
Figure - Connect to SharePoint Online using PowerShell in ISE

Prepare titles, descriptions, files, and URLs

Copy the JSON file of your SharePoint template in your local Downloads folder. Paste the following code into the editor window of the Windows PowerShell ISE.

$SharePointURL = "https://msft.sharepoint.com"
$JSONFile = "ISO9001Lists.json"
$Thumbnail = "QMSiteThumbnail.png"
$DesignTitle = "Quality management"
$DesignDescription = "Define system scope and processes, track risks and actions, and collaborate for evaluation and improvement"
$ScriptTitle = "ISO 9001 lists"
$ScriptDescription = "Creates actions, improvements, issues, objectives, requirements, risks, and opportunities lists"

Paste the SharePoint-URL into the “” at $SharePointURL, the file name (including extension ".png") of your thumbnail into the “” at $Thumbnail, and the JSON file name into the “” at $JSONFile. Check the texts for titles and descriptions.

Variables for uploading a SharePoint site design template in PowerShell ISE
Figure - Variables for uploading a SharePoint site design template in PowerShell ISE

Paste the code and run

Paste the following code into the editor window (all in one line) of the Windows PowerShell ISE. Mark all (Strg+A) and click on Run selection (F8).

Add-SPOSiteDesign -Title $DesignTitle -Description $DesignDescription -WebTemplate "64" -SiteScripts (Add-SPOSiteScript -Title $ScriptTitle -Description $ScriptDescription -Content (Get-Content -Path ($env:HOMEDRIVE + $env:HOMEPATH + "\Downloads\" + $JSONFile) -Raw)) -ThumbnailUrl ($SharePointURL + "/SiteAssets/" + $Thumbnail)
Add-SPOSiteDesign PowerShell command ready to run upload of a SharePoint template
Figure - Add-SPOSiteDesign PowerShell command ready to run upload of a SharePoint template

👍 JSON file and PowerShell script are included in SharePoint QMS template
this SharePoint template adds lists needed for ISO 9001 quality management to a SharePoint Team website

Sources

  • Apply and customize SharePoint site templates (microsoft.com) - https://support.microsoft.com/en-us/office/apply-and-customize-sharepoint-site-templates-39382463-0e45-4d1b-be27-0e96aeec8398
  • Use SharePoint's new site templates today! - Microsoft Tech Community - https://techcommunity.microsoft.com/t5/microsoft-sharepoint-blog/use-sharepoint-s-new-site-templates-today/ba-p/2304372
  • SharePoint site template and site script overview | Microsoft Docs - https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview
  • JSON - Wikipedia - https://en.wikipedia.org/wiki/JSON
  • Add-SPOSiteDesign (Microsoft.Online.SharePoint.PowerShell) | Microsoft Docs - https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/add-spositedesign?view=sharepoint-ps