Power Automate: Apply Site Template to SharePoint Sites
- Introduction
- Out of the Box Templates
- Team Site Templates
- Custom Site Template
- Apply Site Design using Power Automate
- Test the flow
- Summary
Introduction
Site Templates or Site Designs are a way to apply additional functionality commonly across multiple sites. We can apply it during the site provisioning process or after the creation of a site. Site designs have now been renamed as Site Templates. There are out of the box Site Templates that you can apply to sites and creation of a custom site template/design that applies company branding, theme etc is also possible.
Out of the Box Templates
Some of the Out of the Box Team and Communication site templates available are:
Team site templates |
Template ID |
---|---|
Event planning |
9522236e-6802-4972-a10d-e98dc74b3344 |
Project management |
f0a3abf4-afe8-4409-b7f3-484113dee93e |
Training and courses |
695e52c9-8af7-4bd3-b7a5-46aca95e1c7e |
Training and development team |
64aaa31e-7a1e-4337-b646-0b700aa9a52c |
Team collaboration |
6b96e7b1-035f-430b-92ca-31511c51ca72 |
Retail management |
e4ec393e-da09-4816-b6b2-195393656edd |
Communication site templates |
Template ID |
---|---|
Crisis management |
905bb0b4-01e8-4f55-b73c-f07f08aee3a4 |
Department |
73495f08-0140-499b-8927-dd26a546f26a |
Leadership connection |
cd4c26b2-b231-419a-8bb4-9b1d9b83aef6 |
Learning central |
b8ef3134-92a2-4c9d-bca6-c2f14e79fe98 |
New employee onboarding |
2a23fa44-52b0-4814-baba-06fef1ab931e |
Showcase |
89f21161-0892-497a-91cb-5783eeb1f5f2 |
Healthcare |
5215c092-152f-4912-a12a-7e1efdcc6878 |
Store collaboration |
811ecf9a-b33f-44e6-81bd-da77729906dc |
Volunteer center |
b6e04a41-1535-4313-a856-6f3515d31999 |
Topic |
a30fef54-a4e5-4beb-a8b5-962c528d753a |
Blank |
665da395-e0f9-4c92-b35c-773d8c292f2d |
Once you go to a communication site, you can view the Apply Site Template Option from Settings.
Clicking on it will open the window from which we can select a template. Same way, for a Team site, you can get another set of available templates
Team Site Templates
Custom Site Template
In case you want to add some specific functionality that needs to be replicated across sites, we can create Custom Site Templates/Designs as well. Laura has written a detailed article of the step by step process to create a Site Design here.
In case you want to get a list of the Custom Site Designs already deployed and available in the tenant we can use the cmdlet : Get-SPOSiteDesign
We can use Power Shell to later apply the site design to a site using the syntax
Invoke-SPOSiteDesign -Identity <SiteDesignID> -WebUrl <WebURL>
Apply Site Design using Power Automate
In this article, we will see how we can apply an Out of the Box and Custom Site Tempate/Design using Power Automate so that in case one do not have access to PowerShell, they can still get the Job done by passing the SiteDesign ID to a Power Automate.
As the first step, we will create a Power Automate with the manual trigger and add two input options :
varSiteURL |
Text input |
The Site URL where Site Template has to be applied |
varSiteTemplateID |
Text input |
The Site Template ID that has to be used |
Once we have the inputs, we will use it to trigger a Send an HTTP Request to SharePoint action where we will have the following inputs used in the action
Parameter |
Value |
Site Address |
varSiteURL input variable |
Method |
POST |
URI |
_api/Microsoft.SharePoint.Utilities.WebTemplateExtensions.SiteScriptUtility.ApplySiteDesign |
Body |
{ 'webUrl':'@{triggerBody()['text']}', 'siteDesignId': '@{triggerBody()['text_1']}' } |
Thus we have easily setup a simple flow that looks like below to apply the site template
Test the flow
Let’s trigger the flow manually by providing the inputs – Site URL and Site Template ID
Where I will provide a newly created communication site URL and the site template ID of a custom site design which I have created. I have retrieved its ID using the Get- SPOSiteDesign cmdlet.
Submit and Run the flow
The flow has run successfully and as part of the Site Design, it has applied the footer extension to the bottom of the Site.
In case we need to check the Details of the applied site design, we can run the below cmdlet to get the details of the applied design.
Get-SPOSiteDesignRun -WebUrl <WebURL>
Summary
Thus we saw how we can apply Site Templates which were earlier called as Site Designs to a SharePoint Site using Power Automate.