Forum Discussion
Help - API method /breakroleinheritance not working
Hello everyone,
I need help with the breakroleinheritance method, which isn't working. Error Code 404 states that the ressource can't be found (free translated). All articles I looked through say that it should work.
Has anyone an idea how to fix this?
Thanks
WeibchenL Try using API like below based on item ID:
_api/web/lists/GetByTitle('Documents')/items(5)/BreakRoleInheritance(CopyRoleAssignments=true, ClearSubscopes=true)
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
5 Replies
If you are breaking permissions on "folder" inside the document library, try using server relative URL like below once:
_api/web/GetFolderByServerRelativeUrl('/sites/MySite/My%20Library/folder/subFolder')/ListItemAllFields/breakroleinheritance(copyRoleAssignments=true, clearSubscopes=true)Reference: SharePoint API BreakRoleBasedInheritance on Folder doesn't seem to work
For document library, use URL like:
_api/web/lists/getByTitle('Documents')/breakroleinheritance(copyRoleAssignments=true, clearSubscopes=true)
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- WeibchenLCopper ContributorIf I change the content inside the brackets, it says that it cannot find it. Also, it would be ideal if the folder (item)ID could be used somehow, which does not seem to be possible if i take a part uf the URI for server relative URL.
As I do understand my error description, it does find the folder in which I want to break the roleinheritance but the error occurs because it can't find the ressource breakroleinheritance. Does that make any sense?WeibchenL Try using API like below based on item ID:
_api/web/lists/GetByTitle('Documents')/items(5)/BreakRoleInheritance(CopyRoleAssignments=true, ClearSubscopes=true)
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.