Creating a Modern SharePoint Site using Power Automate

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

Here is an example of the JSON content for the request body for a blank communication site:

{
  "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:

References:

Manage modern SharePoint sites using REST

Working with the SharePoint Send HTTP Request flow action in Power Automate

5 comments

  1. Hey, is this still working for you? Looks like it has been blocked. I get an error Bad Request – Invalid Hostname whenevr i call this from a flow

    1. Hi Russel,

      Yes it still works for me. If you want to send more details privately on LinkedIn or Twitter I might be able to help (maybe to see how your request is being sent exactly).

Leave a Reply

Your email address will not be published. Required fields are marked *