How to create SharePoint group from flow
In this article, We will see how to create a SharePoint group from Microsoft flow or Power Automate and assign permission to the group just created. So lets start by creating a mannually triggered flow.
Create a mannually triggered Flow
In order to create a mannually triggered flow, follow below steps.
Go to https://flow.microsoft.com
Click on My flows in left section
Click new top and select Instant - from blank
Choose mannually triggred flow and click Create
At this time your flow will be created. Now we need to add steps to create SharePoint group.
Create SharePoint group
In order to add SharePoint group follow below steps
1. Click Add new step and select send http request to SharePoint
2. Enter your site address
3. Uri : _api/web/SiteGroups
4. Add below two headers
accept : application/json;odata=verbose
content-type : application/json;odata=verbose
5. Enter body as below
"Title": "group name",
"Description":"Group created for categories access"
this action will create group in SharePoin but this group will not have any access we need to make a REST call to
So in order to add permission you need to have two things group id and role definition id
Role definition ids for permission levels are below
1073741829 - Full Control
073741827 - Contribute
1073741826 - Read
Getting Group Id
To get group id, We can parse the body of reponse of request we send to create the group. but to parse the response we need to have schema and luckly we have a way to get schema.
Just run the flow once and then go to run history and click on send request to SharePoint step and it will be expanded and then copy the json body of the response and have it some where.
Now return back to flow, and add a new step and choose parse json.
In body select body from send an HTTP request to SharePoint and in schema
Click generate from sample and paste the json copied in previous step and you are done.
Assign permission to created group
Assigning permission to created group will be very easy. Add a "Send an HTTP request to SharePoint" step and bollow below steps
In site address add your address to site
Coose method as POST
Enter below uri
this should grant visitor permissions
add those two headers accept and content-type as entered while creating group.
You are done. test your flow by triggering mannualy and see how it works.
Would you like to see your article here on tutorialsinhand.
program by tutorialsinhand.com
About the Author
Always ready to learn new technologies, A problem solver, exhibit to do attitude. Having around 10+ years of experience of development and management skills. I believe don't just set random goals but right goals suited for you.
Page Views :
Published Date :