My function for checking List Item permissions in Sharepoint doesn't seem to work. It is placed in aspx file on a Sharepoint 2010 site. I'm getting an error message below when trying to run it. Does anyone know how it should be done ? I found plenty of examples for the same function in C# but can't find anything in Javascript. Thanks !
function checkPermissions(){
var ctx = new SP.ClientContext.get_current();
var oBooksList=ctx.get_web().get_lists().getByTitle('test Repository');
var listItem=oBooksList.getItemById(2);
//ctx.load(listItem.get_roleAssignments());
ctx.load(listItem, 'RoleAssignments');
ctx.executeQueryAsync(
Function.createDelegate(this, this.onSucceededCallback),
Function.createDelegate(this, this.onFailedCallback));
}
function onSucceededCallback(sender, args){
alert('it worked');
}
Error message:
SCRIPT5007: Unable to get value of the property 'apply': object is null or undefined