cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
calvares
Impactful Individual
Impactful Individual

grant access to a SharePoint group

I have a SPD2010 workflow which gave SharePoint groups access to a list item depending on a field in the form.

So if field1 = a, group A would get edit permissions. If field1 = b, then group B would get edit permissions etc.

 

How can I replicate this (easily) in PA?

1 ACCEPTED SOLUTION

Accepted Solutions
tom_riha
Super User
Super User

You can't replicate that easily in PA, there's no special action to assign permissions to SharePoint group. You'll have to use HTTP request for that:

 

_api/lists/getByTitle('<listName>')/items(<itemID>)/roleassignments/addroleassignment(PrincipalId=<SPgroupID>,roleDefId=<roleID>)

 

So it could look like this:

image.png

The <listName> and <itemID> placeholders are clear I suppose, so for the <SPgroupID>, that can be found in the URL on the group screen.

image.png
And for the <roleID>, here's a list of the default permission IDs:

Default permission level IDs 
Full Control1073741829
Design1073741828
Edit1073741830
Contribute1073741827
Read1073741826
Approve1073741927
View1073741832


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

5 REPLIES 5
tom_riha
Super User
Super User

You can't replicate that easily in PA, there's no special action to assign permissions to SharePoint group. You'll have to use HTTP request for that:

 

_api/lists/getByTitle('<listName>')/items(<itemID>)/roleassignments/addroleassignment(PrincipalId=<SPgroupID>,roleDefId=<roleID>)

 

So it could look like this:

image.png

The <listName> and <itemID> placeholders are clear I suppose, so for the <SPgroupID>, that can be found in the URL on the group screen.

image.png
And for the <roleID>, here's a list of the default permission IDs:

Default permission level IDs 
Full Control1073741829
Design1073741828
Edit1073741830
Contribute1073741827
Read1073741826
Approve1073741927
View1073741832


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
calvares
Impactful Individual
Impactful Individual

That's worked nicely. Thanks very much @tom_riha

Hi, what about Document Libraries? This solution only apply to SharePoint lists, right?

As in your website always very helpful tips! Thank You Tom 🙂

OrcPeon
Frequent Visitor

I have a quick question regarding this HTTP-Request:

Is it possible to have 2 Groups in addroleassignment(PrincipalId= 'Group 1' & 'Group 2') with the same roleDefId?

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,094)