Power Automate: Fetch Site Template IDs

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 the creation of a custom site template/design that applies company branding, theme, etc. is also possible.

Many a time we would need the ID of the Site Template to apply it to the Site. In this article, we will see how we can fetch the Site Template ID of all the Out of the Box Site Templates using Power Automate

Scenario

While I was applying the Showcase Site Template to a newly created site, I was fetching the ID from the official documentation where it listed the ID as 89f21161-0892-497a-91cb-5783eeb1f5f2

Table

Description automatically generated

I tried using this in the PowerShell Cmdlet and even after many tries, the template was not getting applied which was when I decided to fetch the ID for Showcase Site Template from SharePoint and we can achieve this by issuing a POST request to the URL :

_api/Microsoft.SharePoint.Utilities.WebTemplateExtensions.SiteScriptUtility.GetSiteDesigns?store=1

Ensure that you append ?store=1 so that it fetches you the Out of the Box Site templates else you will get only the Custom Site Designs/Templates that you have deployed in the Tenant.

Setup the flow

To test this out, we will create a flow that is triggered manually and add the action Send an HTTP request to SharePoint with the below parameters

Site Address

SharePoint Admin Centre URL

Method

POST

Uri

_api/Microsoft.SharePoint.Utilities.WebTemplateExtensions.SiteScriptUtility.GetSiteDesigns?store=1

Graphical user interface, text, application, email

Description automatically generated

The above action will output the body in the below format:

A screenshot of a computer

Description automatically generated with medium confidence

We need to pick the Details like Title and ID which are present in the Results Array of the body object. To do that, let’s add a Select action that will take the results array as the input and map the needed fields so that it will output a JSON of the required fields. We will use the below expressions in the select action

From

outputs(‘Send_an_HTTP_request_to_SharePoint’)?[‘body’][‘d’][‘GetSiteDesigns’][‘results’]

Title

item()?[‘Title’]

Id

item()?[‘Id’]

Description

item()?[‘Description’]

SupportedWebTemplates

item()?[‘SupportedWebTemplates’][‘results’]

A screenshot of a computer

Description automatically generated

Now that we have the filtered output that contains the Site template details, for easier review, we will convert it into a CSV file and share it back via email. We will give the Selection action’s output as the input to the Create CSV table action and use its output as an attachment in the Send an email action.

Graphical user interface, text, application, email

Description automatically generated

Thus the overall flow will look like this:

Graphical user interface, application

Description automatically generated

Test the flow

Lets manually trigger the flow which will pick the site details from the REST URL which goes through the Data format operations like Select and Create CSV actions and we will get the final CSV via mail which would look like this:

A screenshot of a computer

Description automatically generated

Title

Id

Description

SupportedWebTemplates

Department

73495f08-0140-499b-8927-dd26a546f26a

Engage viewers with department news, events, and resources.

[“68”]

Event planning

9522236e-6802-4972-a10d-e98dc74b3344

Coordinate and plan event details with your team.

[“1″,”64”]

Leadership connection

cd4c26b2-b231-419a-8bb4-9b1d9b83aef6

Build organizational culture by connecting leadership and teams.

[“68”]

Project management

f0a3abf4-afe8-4409-b7f3-484113dee93e

Collaborate with your team to share project details and resources.

[“1″,”64”]

Training and courses

695e52c9-8af7-4bd3-b7a5-46aca95e1c7e

Prepare training course participants for specific learning opportunities.

[“1″,”64”]

Training and development team

64aaa31e-7a1e-4337-b646-0b700aa9a52c

Brainstorm and plan opportunities to help others learn.

[“1″,”64”]

Learning central

b8ef3134-92a2-4c9d-bca6-c2f14e79fe98

Provide a landing experience for your organization’s learning opportunities.

[“68”]

New employee onboarding

2a23fa44-52b0-4814-baba-06fef1ab931e

Guide new employees through your organization’s onboarding process.

[“68”]

Crisis management

905bb0b4-01e8-4f55-b73c-f07f08aee3a4

Share news, provide support and connect people to resources in a crisis.

[“68”]

Team collaboration

c8b3137a-ca4c-48a9-b356-a8e7987dd693

Manage projects, share content, and stay connected with your team.

[“1″,”64”]

Blank

f6cc5403-0d63-442e-96c0-285923709ffc

Create your own custom site starting with a blank home page.

[“68”]

Showcase

6142d2a0-63a5-4ba0-aede-d9fefca2c767

Spotlight a product, event, or team using visual content.

[“68”]

Topic

96c933ac-3698-44c7-9f4a-5fd17d71af9e

Engage viewers with informative content like news and events.

[“68”]

Retail management team

e4ec393e-da09-4816-b6b2-195393656edd

Unite retail store managers, emphasize store news, and share management resources.

[“1″,”64”]

Store collaboration

811ecf9a-b33f-44e6-81bd-da77729906dc

Coordinate and prepare retail teams with current store news, resources, and training.

[“1″,”64”]

Volunteer center

b6e04a41-1535-4313-a856-6f3515d31999

Onboard, train, and prepare volunteers for campaigns and events.

[“68”]

The Supported Web template ID tells on which Base Web Template, the Site Template/Design can be applied because we cannot apply a Site Template on a non-compatible Web Template. From the 4th column in the above table, the Web templates correspond to:

  • 1: Team Site Without Office 365 Groups
  • 64: Team Site
  • 68: Communication Site
  • 69: Channel Site

With this exercise, I was able to confirm that the ID mentioned in the Official Documentation for Showcase was “89f21161-0892-497a-91cb-5783eeb1f5f2” but the value we received from the REST API was “6142d2a0-63a5-4ba0-aede-d9fefca2c767”. So, I have raised a document updation request to get this changed.

Summary

Thus, we saw how we can use Power Automate to fetch all the SharePoint Out of the Box Site Templates and their IDs.

Related Articles

Author

Author

Priyaranjan KS is a Modern Workplace Architect primarily focused on developing and architecting solutions around Office 365,Power Platform and Azure.He is also a Microsoft Most Valuable Professional(MVP) and a Microsoft Certified Trainer(MCT)

Latest Articles