How to apply a site template
Site templates were formerly known as site designs. Microsoft has recently added some new ones in SharePoint Online. In this article I will show you how you can apply one to a site from Power Automate.
What is a site template?
A site template contains a consistent set of actions called site scripts. Site scripts can be things like applying a theme, setting the regionals settings of your site or adding a new library. A site template can be applied to existing sites. You can either use the ones provided by Microsoft or create one yourself.
Below is a list of the Microsoft Site Templates have provided at this point in time (23-07-2021). You can use the GUID of the template you want to use later on in the Power Automate flow.
|Title||GUID||Supported Web Templates|
|Department||73495f08-0140-499b-8927-dd26a546f26a||Communication Site (68)|
|Event planning||9522236e-6802-4972-a10d-e98dc74b3344||Team Site (64)|
|Leadership connection||cd4c26b2-b231-419a-8bb4-9b1d9b83aef6||Communication Site (68)|
|Project management||f0a3abf4-afe8-4409-b7f3-484113dee93e||Team Site (64)|
|Training and courses||695e52c9-8af7-4bd3-b7a5-46aca95e1c7e||Team Site (64)|
|Training and development team||64aaa31e-7a1e-4337-b646-0b700aa9a52c||Team Site (64)|
|Learning central||b8ef3134-92a2-4c9d-bca6-c2f14e79fe98||Communication Site (68)|
|New employee onboarding||2a23fa44-52b0-4814-baba-06fef1ab931e||Communication Site (68)|
|Crisis management||905bb0b4-01e8-4f55-b73c-f07f08aee3a4||Communication Site (68)|
|Team collaboration||c8b3137a-ca4c-48a9-b356-a8e7987dd693||Team Site (64)|
|Blank||f6cc5403-0d63-442e-96c0-285923709ffc||Communication Site (68)|
|Showcase||6142d2a0-63a5-4ba0-aede-d9fefca2c767||Communication Site (68)|
|Topic||96c933ac-3698-44c7-9f4a-5fd17d71af9e||Communication Site (68)|
How did you find those GUIDs?
I found these Site Templates and its GUIDs by using a REST API method, GetSiteDesigns. The only thing you need to do is add ?store=1 at the end. Below is screenshot of that request in a Power Automate flow action.
How can you create your own?
It is also possible to create your own custom site templates. First of all you need to created the site scripts can via JSON files. These site scripts can be added to one or multiple site templates. You can deploy the site templates and site scripts to your tenant via PowerShell or the REST API.
1. Create a site script and add it via the Add-SPOSiteScript cmdlet to your tenant via SharePoint Online PowerShell.
Replace the principal value by the user or group you want to use to add to the owners.
2. Use the ID from the output to create a Site Design via the Add-SPOSiteDesign cmdlet. 68 is the id of a Communication site btw.
Apply the Site Template via Power AutomateIn this flow we will automatically apply a site template to a site collection. In our example we are using the custom site template we created earlier, Test Communication Site. The GUID of this custom site template is 9e8294b4-551f-4777-bc17-b7fdaf773144. Make sure you use the correct GUID when setting up your flow.
1. Add a Manually trigger a flow action.
2. Add a Send an HTTP request to SharePoint action. Select your the target site for the Site Address field. Use the AddSiteDesignTaskToCurrentWeb method in the URI. Also make sure you use the id of the site template you want to use in your body.
That should be it from a configuration point of view. Now just manually run it and the site template should be applied to your target site.