break folder inheritance REST
-
07-02-2021 - |
Question
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?
No correct solution
OTHER TIPS
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: