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?

  • Do you have the permissions on Style Library to break inheritance or to change the permissions?? – Ganesh Sanap Jul 8 at 10:40
  • Yes. I am the site admin. – notorious Jul 8 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 – Ganesh Sanap Jul 8 at 11:08
  • Inheritance is not broken on style library. I am the admin of site and I have permission on style library too. – notorious Jul 8 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. – Ganesh Sanap Jul 8 at 11:16
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.
  • NO change. Same error. – notorious Jul 8 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.