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
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (4,881)