How to remove all User Permission on a SharePoint list using REST API in SharePoint online or Sharepoint 2013/2016?

Hello SharePointers,

In this blog, we will see the piece of code to remove user Permissions using REST API.

// REST header
var headers = {
“Accept”: “application/json;odata=verbose”,
“content-Type”: “application/json;odata=verbose”,
“X-RequestDigest”: jQuery(“#__REQUESTDIGEST”).val()
}

var RESTUrl = “http://site/” + “_api/web/lists/getByTitle(‘CustomListName’)/breakroleinheritance(copyRoleAssignments=false, clearSubscopes=true)”;

var call = jQuery.ajax({
url: endPointUrl,
type: “POST”,
headers: headers,
dataType: ‘json’,success: function (data) {
alert(‘Successfully removed Permission !’);

},
error: function (error) {
alert(JSON.stringify(error));
}
});

Happy Share Pointing Folks!!

Leave a Reply

Your email address will not be published.