cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ramiz
Helper III
Helper III

Remove folder permission using HTTP

Hi,

I am trying to remove permission from a folder in document library using HTTP.  I have tried these two commands.

 

_api/web/GetFolderByServerRelativeUrl('url')/ListItemAllFields/breakroleinheritance(true)

_api/web/GetFolderByServerRelativeUrl('url')/ListItemAllFields/breakroleinheritance(copyRoleAssignments=true,clearSubscopes=true)

 

 But the flow is keep running and its showing retries and in the end it says bad gateway. I am putting the URL of a folder in a string variable and then passing it in the flow.

Folder URLFolder URL

Screenshot_1.png

Each user has their own folder and folders are created on runtime. My requirement is to remove all permission on a folder and then assign the relevant user to it.

3 REPLIES 3
Brad_Groux
Community Champion
Community Champion

Bad gateway errors are generally a communication error. You may want to review your syntax - Working with folders and files with REST | Microsoft Docs. Have you tried verifying your URI syntax via an API test call?

I always verify my API calls in VS Code with the REST Client Extension before adding them to a Flow. Also, the run error messages should give you some further insights of where the issue lies.

If you could provide an expanded screenshot of your Flow and steps, your Flow run history, and of any detailed error messages you're receiving we could likely better assist you. Also, for the best results, you may want to review How to write a good forum post.

If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION ☑️. If you find this reply helpful, please consider giving it a LIKE. Want to know more? Follow @BradGroux on Twitter, and check out my Medium blog at https://msft.engineer.

 

@Brad_Groux  Thanks for your answer. I will verify the api call but I would like to know is this the correct api for breaking inheritance of folders in document library?

 

 

_api/web/GetFolderByServerRelativeUrl('url')/ListItemAllFields/breakroleinheritance(true)

_api/web/GetFolderByServerRelativeUrl('url')/ListItemAllFields/breakroleinheritance(copyRoleAssignments=true,clearSubscopes=true)

Here is the error description.
Screenshot_1.png

Brad_Groux
Community Champion
Community Champion

/_api/web/GetFolderByServerRelativeUrl('"+folderRelativeUrl+"')/ListItemAllFields/breakroleinheritance(true)

Yes, that is the correct syntax according to the SharePoint REST API documentation

If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION ☑️. If you find this reply helpful, please consider giving it a LIKE. Want to know more? Follow @BradGroux on Twitter, and check out my Medium blog at https://msft.engineer.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

Top Solution Authors
Users online (1,015)