1

I am trying to break inheritance using Rest. But I am getting error Undefined.

I am using below code :

var url = _spPageContextInfo.webAbsoluteUrl; var headers = { "Accept": "application/json;odata=verbose", "content-Type": "application/json;odata=verbose", "X-RequestDigest": jQuery("#__REQUESTDIGEST").val() } var endPointUrl = url + "/_api/web/GetFolderByServerRelativeUrl('Style%20Library')/breakroleinheritance(copyRoleAssignments=true, clearSubscopes=true)" $.ajax({ url: endPointUrl, type: "POST", headers: headers, dataType: 'json', success: function (data) { console.log('Inheritance Broken Successfully!'); } error: function (error) { console.log(error.message); }

Any leads, where it is going wrong?

7
  • Do you have the permissions on Style Library to break inheritance or to change the permissions?? Commented Jul 8, 2019 at 10:40
  • Yes. I am the site admin. Commented Jul 8, 2019 at 10:40
  • I guess in SharePoint, by default inheritance is broken on Style Library, Can you please check again if you have permissions on style library from settings->Permissions for this document library->Check Permissions Commented Jul 8, 2019 at 11:08
  • Inheritance is not broken on style library. I am the admin of site and I have permission on style library too. Commented Jul 8, 2019 at 11:13
  • Are you able to access https://yoursite/_api/web/GetFolderByServerRelativeUrl('Style Library from you browser? Try this directly in your browser window. Commented Jul 8, 2019 at 11:16

1 Answer 1

1

Try using your endpoint URL like given below:

var endPointUrl = url + "/_api/web/GetFolderByServerRelativeUrl('Style%20Library')/ListItemAllFields/breakroleinheritance(copyRoleAssignments=true, clearSubscopes=true)"

Similar questions for Reference:

  1. Break inheritance on a folder using REST.
  2. Sharepoint Rest API breakRoleInheritance Of Folder.
1
  • NO change. Same error. Commented Jul 8, 2019 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.