Are you wondering how could you create a SharePoint modern site using Power Automate to automate a site creation process and found out there is no action to create sites?
Don’t worry, you can use SharePoint Rest API and the Send an HTTP Request to SharePoint action for that. Before using it, a few things to be aware.
EndPoint/Settings
To create sites you need to use the base url: _api/SPSiteManager/create
We need to do a POST request with the Accept header: application/json;odata=none
Site Type (WebTemplate)
You will need to use one of the following values according to the type of site you want to create:
- Communication Site:
SITEPAGEPUBLISHING#0
- Team Site (not connected to a group):
STS#3
Site Template (previously known as site design)
For the site design values, you can use the identifier (GUID) for any site template/design you created, or use some of the default ones.
Site Owner
Use the user’s login name.
Request body format
{
"request": {
"Title": "Test",
"Url":"https://yourtenant.sharepoint.com/sites/mysiteurltest",
"Lcid": 1033,
"ShareByEmailEnabled":false,
"Description":"This is my site",
"WebTemplate":"SITEPAGEPUBLISHING#0",
"Owner":"user@yourtenant.onmicrosoft.com",
"SiteDesignId":"f6cc5403-0d63-442e-96c0-285923709ffc"
}
}
Final Action in Power Automate
Based on the information above you can use the Send an HTTP request to SharePoint action to create sites in your Flows (you can use variables to build the JSON content dynamically, the raw content shown below is only for better explanation):
Results
If the call is successful and the site is created, after the Flow run is executed you can check that the SiteStatus is 2 (Ready) and the confirmation for Site ID and URL filled on the output:
This blog is part of SharePoint Week. For more great content, click here
About the Author:
SharePoint/Microsoft 365 Consultant
Microsoft techologies enthusiast
Follow Michel on Twitter @michelcarlo
Reference:
Mendes, M. (2021). Creating a Modern SharePoint Site using Power Automate. Available at: https://michelcarlo.com/2021/06/19/create-a-modern-sharepoint-site-using-power-automate/ [Accessed: 13th September 2021].