Forum Discussion

Re: Help - API method /breakroleinheritance not working

WeibchenL 

 

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)

 

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

4 Replies

  • WeibchenL's avatar
    WeibchenL
    Copper Contributor
    If 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?
    • ganeshsanap's avatar
      ganeshsanap
      MVP

      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.

      • WeibchenL's avatar
        WeibchenL
        Copper Contributor
        I really don't know how, I tried so many combinations, also I couldn't get it to work with your first response. But based on item ID it worked!

        Thank you so much, I could bake you a cake.
        Maybe I will if you ever visit Palatinate (Region in Germany) xD

Resources