Applying a consistent site template across newly created SharePoint sites is essential for maintaining uniformity, particularly for departmental sites. While designing and creating templates is straightforward, the application process—requiring manual site visits or PowerShell script executions—is less efficient. This gap underscores the need for automation, eliminating the need for manual interventions or technical scripting. In this article, we introduce a streamlined method to automate site template applications, ensuring consistency and efficiency across your SharePoint environment.

Leverage Power Automate for Seamless SharePoint Site Template Applications

Unlock the power of automation with Power Automate by setting up a new flow using a SharePoint administrator account. Here’s how to streamline your process:

  1. Initiate your Flow: Select the ‘When an item is created’ SharePoint trigger to start your automation whenever a new site is created.
  2. Configure Site Address: Input the custom URL of your Admin site in the format https://{domain} to specify where your flow should monitor for new site creations.
  3. Specify the List Name: Enter DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS as the list name. This special list captures all newly created sites, ensuring no site, including those associated with Microsoft Teams, is overlooked.

By following these steps, you establish a foundation for applying templates automatically to every new SharePoint site, including those created for Microsoft Teams, enhancing consistency and efficiency across your digital workspace.

Streamlining Site Template Application with Power Automate and Azure Functions

Once a new SharePoint site is created, the flow initiates, albeit with a slight delay. This delay is a small trade-off for the automation benefits you gain. At this stage, your flow can send a message to a queue, including crucial site details such as the ‘SiteUrl’.

Important Note: The activation of this flow is not immediate. There may be a brief waiting period before the flow triggers. Despite this, it remains the most efficient automation method I’ve encountered for this purpose.

Next Steps: Leveraging Azure Functions

The automation journey continues with the creation of an Azure Function, specifically designed to respond to queue messages. This function, triggered by the queue, grants you the power to programmatically adjust your SharePoint site, including the application of the desired site template.

For guidance on creating an Azure Function to apply a site template, please consult the Microsoft documentation. This resource provides comprehensive steps and best practices:

Microsoft Documentation on Creating Azure Functions for Site Templates

This link directs you to detailed instructions for leveraging PnP provisioning with Azure Functions, facilitating the application of site templates in SharePoint.

About the Author

Developer, Designer, Thinker, Problem Solver, Office Servers and Services MVP, & Collaboration Director @ SoHo Dragon.

View Articles