locked
SharePoint 2013 breakroleinheritance using rest api return Forbidden RRS feed

  • Question

  • Hello,

    I have problem with break role inheritance using SharePoint Rest Api. We have installed SharePoint on our local servers. 

    I'm using Visual Studio 2013 workflow activity HttpSend. Workflow is part of sandboxed solution.

    Request Url is

    http://<sitecollection>/_api/web/lists/getById('<ListGuid>')/Items(1)/breakroleinheritance(copyRoleAssignments=false,clearSubscopes=true)

    this request is send with headers:

    Accept - application/json;odata=verbose

    Content-Type - application/json;odata=verbose

    X-RequestDigest - FormRequestDigestValue

    Authorization - 

    The value of FormRequestDigest is from result of calling service

    http://<sitecollection>/_api/contextinfo

    Service response code is Forbidden and list item is still inheriting rights from list.

    When I deleted the Autorization header, service response was Unauthorized.

    What I'm doing wrong? It looks like security problem, but i don't have any idea how to solve it.

    Thursday, November 5, 2015 8:09 AM

Answers

  • Hi Branishlav,

    If you want to BreakRoleInheritance for listitem, we can use the RestAPI to do it for the list object:

    http://your_sp_site.sharepoint.com/_api/web/lists/getByTitle('Test')/breakroleinheritance(copyRoleAssignments=true, clearSubscopes=true)

    This method will use Post method to execute.

    Here is a detailed article about BreakRoleInheritance for item level using Rest API would be helpful:

    SharePoint 2013 REST API – How to set Unique Permissions (Item Level Permissions)

    If the issue still exists, I suggest you can use Fiddler to trace the web request to find more detailed error information:

    Fiddler

    Thanks

    Best Regards


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Saturday, November 7, 2015 6:13 AM

All replies

  • Hi Branishlav,

    If you want to BreakRoleInheritance for listitem, we can use the RestAPI to do it for the list object:

    http://your_sp_site.sharepoint.com/_api/web/lists/getByTitle('Test')/breakroleinheritance(copyRoleAssignments=true, clearSubscopes=true)

    This method will use Post method to execute.

    Here is a detailed article about BreakRoleInheritance for item level using Rest API would be helpful:

    SharePoint 2013 REST API – How to set Unique Permissions (Item Level Permissions)

    If the issue still exists, I suggest you can use Fiddler to trace the web request to find more detailed error information:

    Fiddler

    Thanks

    Best Regards


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Saturday, November 7, 2015 6:13 AM
  • Try this:

    url: _spPageContextInfo.siteServerRelativeUrl + "/_api/web/lists/GetByTitle('" + listTitle + "')/getitembyid(" + id + ")/breakroleinheritance(copyRoleAssignments=false, clearSubscopes=false)",

    Kind regards,

    Pieter

    Tuesday, April 25, 2017 12:50 PM