cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PipManifold
Resolver I
Resolver I

Add user group permissions to a file in a sharepoint library - send an http request to sharepoint

Hi there,

I’m trying to add access to a user group using Flow.

I’m building a minutes repository and I’ve created a PowerApp which the different disciplines in our college can add the minutes to it using.

On the repository SharePoint I have created a user group for each discipline and I want Flow to give the correct group access. From my reading, you use a send HTTP request to Sharepoint to get the group and as it identifies using a string I’m getting PowerApps to look up the group name.

Then you initialize the variable using this function: body(‘Send_an_HTTP_request_to_-SharePoint’)[‘d’][‘id’]

Then you use a second Send an HTTP request to SharePoint but my flow is failing to add the user group.

I think it might be because my URI expression is for lists and I want to add permission to a file in a library.

Permissions cap.PNG

Any help would be greatly appreciated

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @PipManifold :
If you want to assigning permission for folder ,maybe you could try:

https://{site Url}/_api/web/GetFolderByServerRelativeUrl(‘Lists/{DocLibName }/{folder url}’)/ListItemAllFields/roleassignments/addroleassignment(principalid={User or group id},roleDefId={Role definition id})

I think this link may help you a lot:
SharePoint REST API URL for accessing List items,documents,assign permission in list, document libra... 

Best Regards,

Bof

View solution in original post

1 REPLY 1
v-bofeng-msft
Community Support
Community Support

Hi @PipManifold :
If you want to assigning permission for folder ,maybe you could try:

https://{site Url}/_api/web/GetFolderByServerRelativeUrl(‘Lists/{DocLibName }/{folder url}’)/ListItemAllFields/roleassignments/addroleassignment(principalid={User or group id},roleDefId={Role definition id})

I think this link may help you a lot:
SharePoint REST API URL for accessing List items,documents,assign permission in list, document libra... 

Best Regards,

Bof

Helpful resources

Announcements
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.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,899)