DEV Community

Cover image for How to create a modern Team site with Microsoft 365 group using Power Automate
Fernanda Ek
Fernanda Ek

Posted on

How to create a modern Team site with Microsoft 365 group using Power Automate

(THIS POST HAS BEEN MIGRATED FROM MY PREVIOUS BLOG PUBLISHED ON DECEMBER 12, 2020.)

OMG! I completely forgot about this blog. The reason for my absence is not that I didn't have much to write about (in fact, it's the opposite). I had so many ideas, but I haven't had the time to sit down and organize them to post here. So, let's get started!

The other day, I was asked to create a list that would trigger a flow to automate the creation of a modern Team Site associated with an Office 365 group. I have to be honest, the process was not as straightforward as I had imagined. Here, I'll explain how I achieved my goal.

I started by creating a list with the necessary columns (the user will only need to fill in the "Name" field, which is the name of the Team Site)...

Image description

I then moved to Power Automate and started work on my flow. As the trigger, I selected "When an item is created" to retrieve the list of projects I created in the previous step.

Image description

Here comes the magic important part, the action! It will literally add action to your flow. In the new step, I searched for the action "Send an HTTP request to SharePoint".

In Power Automate, the SharePoint Send HTTP Request flow action lets you construct and execute SharePoint REST API queries. This action is particularly useful in cases where the existing SharePoint flow actions do not handle your requirements, or the action you are looking for is not yet available in the SharePoint connector. As Microsoft's documentation explains, this action allows you to extend your SharePoint capabilities beyond what is available out of the box.

Image description
Then fill the fields as image bellow.

Image description
In "Site address", you're going to put your root address like so: https://TENANT.sharepoint.com.

In the Uri as endpoint, you're going to use "/_api/GroupSiteManager/CreateGroupEx". This will allow you to pass the Display Name, Alias, and the boolean "isPublic".

The next step is to add the "Parse JSON" action and paste the output of the "Send an HTTP request to SharePoint" action into the "Schema" field.

Image description

Image description
When it's done, you're good to go and update your list item with the newly created properties. To do so, you will need to add one more action: "Update file properties".

Image description

This time, in the "Site Address" field, you're going to select the site where your list lives, something like so: https://TENANT.sharepoint.com/sites/SITENAME/Lists/LISTNAME. Select the list you created in the first step of this tutorial and the item ID. Fill the fields of your list columns and, hopefully, everything is successfully configured.

Whenever you create a new item in the list, a new modern Team Site should be created and the flow updates the list columns with the new status (Active) and URL.

So, that's it! I hope you find this post helpful and why not develop it further with an approval request or assign multiple owners?

See you in the next post! 😉

Top comments (0)