Auto-Create M365 Group for New Project
When a new project is added to a SharePoint list, auto-create an Office 365 Group with the project name and add the project lead as owner.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow automates the creation of Microsoft 365 Groups whenever a new project is added to a SharePoint list. It eliminates the manual step of setting up collaboration infrastructure for new projects by automatically provisioning the group, adding the project lead as a member, updating the SharePoint record, and sending a confirmation email.
Use Case
Project managers or PMO staff add new projects to a central SharePoint list. Without automation, someone must manually create a Teams/M365 Group, invite the project lead, and record the group details. This flow handles all of that automatically, ensuring every project gets a collaboration space within seconds of being registered.
The flow is ideal for teams that:
- IT Admins responsible for provisioning collaboration spaces
- Project Managers and PMO staff who onboard new projects
- Teams that want consistent, automated M365 Group creation tied to a SharePoint list of record
Flow Architecture
When a New Project Is Created
SharePoint - When an item is createdSharePoint GetOnNewItems webhook trigger on the FlowLibs - Projects list. Fires whenever a new project row is added.
Init varSharePointSiteUrl
Initialize VariableLoads the SharePoint site URL from the flowlibs_SharePointSiteURL environment variable.
Init varProjectsListGuid
Initialize VariableLoads the Projects list GUID from the flowlibs_ProjectsListGuid environment variable.
Init varNotificationEmail
Initialize VariableLoads the notification email address from the flowlibs_NotificationEmailAddress environment variable.
Init varMailPrefix
Initialize VariableLoads the M365 group mail-nickname prefix from the flowlibs_M365GroupMailPrefix environment variable.
Init varGroupId
Initialize VariableEmpty string variable that will hold the new group's ID after creation. Steps 1-5 run in parallel.
Create M365 Group via Graph
Office 365 Groups - HttpRequestV2POSTs to the Microsoft Graph endpoint /v1.0/groups to create a Unified (M365) group. The body is built dynamically from the project title, description, and computed mail nickname.
Parse Group Creation Response
Parse JSONParses the Graph response and extracts id, displayName, mail, and mailNickname for downstream steps.
Set varGroupId
Set VariableStores the newly created group's GUID in varGroupId so later actions can reference it.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SharePointSiteURL | String | https://your-tenant.sharepoint.com | Root SharePoint site where the Projects list lives. Set this to your tenant's SharePoint site URL. |
| flowlibs_ProjectsListGuid | String | <configure> | GUID of the SharePoint Projects list the trigger watches. Find it under List settings or via PowerShell/Graph and paste it here. |
| flowlibs_NotificationEmailAddress | String | alerts@yourcompany.com | Recipient of the confirmation email sent after a group is created. |
| flowlibs_M365GroupMailPrefix | String | proj- | Prefix prepended to the group's mail nickname (e.g., proj-my-project). |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| SharePoint Online | shared_sharepointonline | GetOnNewItems (trigger) PatchItem |
| Office 365 Groups | shared_office365groups | HttpRequestV2 (creates the group via Graph) AddMemberToGroup |
| Office 365 Outlook | shared_office365 | SendEmailV2 |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Import the solution and authorize connections
- Import the solution zip into the target environment and authorize the SharePoint, Office 365 Groups, and Outlook connection references with an account that can create M365 groups and read/write the Projects list.
- Provision the Projects SharePoint list
- Create a SharePoint list with columns Title (Text), ProjectLead (Text, UPN format), Department (Choice), ProjectDescription (Note), GroupCreated (Yes/No), and GroupId (Text). The flow's PatchItem step writes GroupCreated and GroupId back to this list.
- Set environment variable values for your tenant
- Set flowlibs_SharePointSiteURL to your tenant's SharePoint root site, flowlibs_ProjectsListGuid to the GUID of the new Projects list, flowlibs_NotificationEmailAddress to your desired recipient, and flowlibs_M365GroupMailPrefix to your preferred mail-nickname prefix.
- Turn on the flow after configuration
- The flow is shipped in the Stopped (Off) state. After importing, configuring connections, and setting env vars, enable the flow so the SharePoint trigger starts firing.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Mail nickname generation
Converts a project title like "My Project" into a mail nickname like "proj-my-project" by lower-casing and replacing spaces with hyphens, then prepending the configured prefix.
EXPR.02Project lead condition check
Used in the If condition to verify the ProjectLead column is non-empty before attempting to add the project lead to the new group.
EXPR.03Graph group creation body
The HttpRequestV2 body uses the parallel-initialized variables to assemble a Unified group creation payload (displayName, description, mailNickname, mailEnabled=true, securityEnabled=false, groupTypes=["Unified"]).
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.