Reset Permission Inheritance of Library using CSOM
Recently I am doing an activity in which I break permission inheritance of library by mistake so I thought, this can easily reset using ribbon option. But the site in which I am working, I am not able to see “Delete Unique Permission” button. So I have executed below code in order to reset permission of library
var siteUrl = <<SiteURL>> var clientContext = new SP.ClientContext(siteUrl); this.oList = clientContext.get_web().get_lists().getByTitle(<<ListName>>); oList.resetRoleInheritance(); clientContext.load(oList); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed)); function onQuerySucceeded(sender, args) { alert(this.oList.get_title() + ' role inheritance reset'); } function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); }
You can use same approach for resetting inheritance of folder or document.
Enjoy SharePoint !!!
1,970 total views, 2 views today
0 Comments