Create a SharePoint Online Communication Site Using Power Automate [Download Complete Package]

Recently, I was working on a client requirement where I needed to create a SharePoint communication site using Power Automate. The client, a large marketing agency, wanted to streamline their process of setting up new project spaces for their clients. They required a solution that would automatically create a Communication Site whenever a new project was initiated, saving time and ensuring consistency across all project spaces.

The challenge was to automate the creation of these sites without manual intervention, allowing project managers to focus on their core responsibilities rather than site setup. Power Automate seemed like the perfect tool for this task, as it could integrate seamlessly with SharePoint Online and other Microsoft 365 services.

In this complete tutorial, we will see how to create a SharePoint Online communication site using Power Automate. Also, we will see how to add members to a SharePoint communication site and define the maximum storage limit and maximum storage warning limit.

Here, we will create an Instant cloud flow, and then we will do the rest of the API calls to SharePoint to create a SharePoint Online communication site. Then we will fetch the SharePoint site id to define the Storage limit and Storage warning limit, after that, we will get the group id to add the members to the SharePoint site using the rest API call.

Create a SharePoint Communication site with rest api call in Power automate

Now, let’s see how we can create a SharePoint Communication site with the rest API call in Power Automate.

Download Complete Package

You can download a complete package where we have created a flow using Power Automate, where users can request a SharePoint site by filling out a form. Users will fill out a SharePoint list form by adding the below details:

  • Site Title (Single line of text)
  • Site Owner (Person)
  • Alias (Single line of text)
  • Site URL (Hyperlink)
  • Site description (Multi-line of text)
  • Site member (Person)
  • Max Storage (Number)
  • Max storage warning limit (Number)

Once the request is received, the first thing the flow will check is the site storage, if a user requested more than 50GB of storage, then it will go for approval to a concerned approver.

Otherwise it will create a SharePoint site and email the Site Owners with the Site Details.

Currently, the flow supports 3 types of sites:

  • SharePoint Online communication site
  • SharePoint Online Team site (Office 365/Microsoft 365 Group connected)
  • SharePoint Online Team site (Without Office 365/Microsoft 365 Group connected)

Create a SharePoint Online Communication Site using Power Automate

Here, we will see how we can create an instant cloud flow to build a communication site in SharePoint Online using Power Automate.

Follow the below steps to create a SharePoint communication site using Power Automate.

Step 1: Create an Instant Cloud Flow

Log in to Power Automate, and then click on + Create -> select Instant Cloud Flow.

Create a Communication site in SharePoint with rest api call in Power automate

Then, provide the Flow name, and select ‘Manually trigger Flow‘ as a trigger action-> click on Create.

How to create a Communication site in SharePoint with rest api call in Power automate

Now you can see the Manually trigger flow action is added to our Flow.

How to create a Communication site in SharePoint Online with rest api call in Power automate

Step 2: Create a SharePoint site

Now, we will create a SharePoint Communication site with a rest API call. So here we need the Site information to create, such as Site name, Site alias, site owners, Site member, the language of the site(for English, the code is 1033), Site design ID, site template(for communication site: SITEPAGEPUBLISHING#0)and ShareByEmailEnabled.

Click on the +New step-> select Compose action -> then provide the information:

  • Input: In the input field, we will add an expression to create a GUID. Every time when we run the flow, it will create a new ID, which we assign as the Site design ID.
guid()
create a Communication site in SharePoint Online with rest api call in Power automate

So, click on the +New step -> select the action ‘Send an HTTP request to SharePoint’. Then provide the below information:

  • Site address -provide the SharePoint tenant address
  • Method- Select method as Post; we are creating the SharePoint communication site
  • Uri -We provide the ‘/_api/SPSiteManager/create’ to call the SharePoint Api endpoint.
  • Headers: Provide the headers like below:
{
  "accept": "application/json;odata=verbose",
  "content-type": "application/json;odata=verbose"
}
  • Body: Provide the essential information below to create a SharePoint communication site.
{
	"request": {
		"Title": "Nia",
		"Url": "https://tsinfotechnologies.sharepoint.com/sites/nia",
		"Description": "My Communication Site created using Power Automate flow",
		"Owner": "[email protected]",
		"Lcid": 1033,
		"WebTemplate": "SITEPAGEPUBLISHING#0",
		"SiteDesignId": "@{outputs('Compose')}",
		"ShareByEmailEnabled": true

	}
} 
create a Communication site in SharePoint Online with rest api call in Microsoft Flow

Step 3: Set the Storage limit of the SharePoint site

We need the site URL and group id to set the storage limit of the SharePoint online communication site. For this, we will use the Parse JSON of the above output of ‘Send an HTTP request to SharePoint’, and then we will send an HTTP request to set the SharePoint site’s storage limit and storage warning limit.

So, click on the +New step, select the Parse JSON action, and provide the information below.

  • Content: Select the body(Send an HTTP request to SharePoint) from the dynamic content.
  • Schema: To add the schema, click on ‘Generate from sample’, then add the code below and click on done. Now you can see the Schema.
{
  "d": {
    "Create": {
      "__metadata": {
        "type": "Microsoft.SharePoint.Portal.SPSiteCreationResponse"
      },
      "SiteId": "ade47e06-2b50-461c-9c92-e182356de1a2",
      "SiteStatus": 2,
      "SiteUrl": "https://tsinfotechnologies.sharepoint.com/sites/nia"
    }
  }
}
create a Communication site in SharePoint Online with rest api call in Flow

Now, we will set the storage limit using two parameters, i.e., ‘ StorageMaximumLevel’ and ‘StorageWarningLevel’ in SharePoint rest API call.

So, click on the + New step -> then select the ‘Send an HTTP request to SharePoint‘ action, and provide the information below.

  • Site Address: Select or provide the SharePoint Admin center address
  • Method: Select POST; we are providing the storage limit.
  • Uri: Provide the Uri as ‘_api/Microsoft.Online.SharePoint.TenantAdministration.Tenant/Sites(‘@{body(‘Parse_JSON_3’)?[‘d’]?[‘Create’]?[‘SiteId’]}’)’, we are doing API calls to that site to set the storage limit of the site.
  • Headers: Provide like the below code example (There are required while you are calling a rest API call)
{
  "Accept": "application/json;odata=nometadata",
  "Content-Type": "application/json;odata=nometadata",
  "X-HTTP-Method": "MERGE"
}
  • Body: Provide the below code example (Which is required while you are calling a rest API call)to set the storage limit. Also, you can change the storage based on your requirements.
{
"StorageMaximumLevel": "80000",
"StorageWarningLevel": "62000"
}
Power Automate create a communication site in sharepoint

As we have set the storage limit for the SharePoint site, we will add members to the SharePoint site next.

Step 4: Add members to the SharePoint communication site

To add members to the SharePoint communication site, first, we will fetch the group ID of the SharePoint site, and then by using that ID, we will add one member or multiple members to the SharePoint site.

Similarly, we can add Site visitors to the site by using the Site visitor group id.

So, click on the + New step, then -> select ‘Send an HTTP request to SharePoint’, to get the group id.

Then provide the below information:

  • Site Address: Select or provide the SharePoint Admin center address
  • Method: Select Get; we need to get the storage limit.
  • Uri: Provide the Uri as ‘_api/web?$select=AssociatedMemberGroup/Id&$expand=AssociatedMemberGroup’; we are doing API calls to that site to get the group ID of the SharePoint site member group.
  • Headers: Provide like the below code example (There are required while you are calling a rest API call)
{
  "Accept": "application/json;odata=nometadata"
}
How to create a Communication site in SharePoint Online with rest api call in Microsoft Power Automate

Once you get the id, to use this id we will parse json the output body of the above action ‘Send an HTTP request to SharePoint’

So, click on the +New step -> select Parse JSON action, then provide the below information:

  • Content: Select the body from the above action ‘Send an Http request to SharePoint’.
  • Schema: To get schema, click on ‘ Generate from sample’ and then provide the code below. You see, the schema is auto-generated.
{
  "AssociatedMemberGroup": {
    "Id": 5
  }
}
How to create a Communication site in SharePoint Online using Microsoft Power Automate

Now we will add the member to the SharePoint site, as we have the group ID, so click on the +New step. Then select ‘Send an HTTP request to SharePoint’, action, and provide the below information.

  • Site Address: Select the Site URL -Parse json from the dynamic content.
  • Method: Select Post; we need to add the member to the SharePoint site.
  • Uri: Provide the Uri as ‘/_api/web/sitegroups/getById(5)/users’, we are doing API calls to that site to add members to the SharePoint site.
  • Headers: Provide like the below code example (There are required while you are calling a rest API call)
{
  "accept": "application/json;odata=verbose",
  "content-type": "application/json;odata=verbose"
}
  • Body: Provide the code below, where we have provided the member details to add to the SharePoint site.
{
    "__metadata": {
        "type": "SP.User"
    },
    "LoginName": "i:0#.f|membership|[email protected]"
}
Create a communication site in sharepoint online using power automate

Note:

Make sure that the SharePoint connector having the connection same as the Site owner, you have define while creating SharePoint site. To check the connector on your application, click on the More options(…) -> you can see all the connections under the My connections

Now our Flow is ready to go, so you can test the flow and ,every time,e change the site name and alias in Url.

Step 5: Run the Flow

To run the flow, save the flow and click on the Test icon, ->Manually -> click on the Test button. Next, connect to the credential, and then click on the Continue button -> Next, click on the Run Flow button -> click on Done.

You can see your flow runs successfully, and we can check our flow in the active sites in the SharePoint admin center.

How to create a Communication site in SharePoint using Power Automate
Create a Communication site in SharePoint using Power Automate

Now you can check the Storage limit and whether Members added to the site or not.

How to create a SharePoint Online Communication site using Power Automate

Conclusion

In this Power Automate tutorial, we saw how to create a SharePoint Online Communication site using Power Automate rest API call. Also, we saw how we can set the site’s storage limit and how we can add members to the SharePoint site.

You may also like the following Power Automate tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…