如何使用 Javascript 客户端对象模型检索 Sharepoint 2010 列表项权限
How to retrieve Sharepoint 2010 list item permissions using Javascript Client Object Model
我在 Sharepoint 中检查列表项权限的功能似乎不起作用。它位于 Sharepoint 2010 站点上的 aspx 文件中。我在尝试 运行 时收到以下错误消息。有谁知道应该怎么做?我在 C# 中找到了很多相同函数的示例,但在 Javascript 中找不到任何内容。谢谢!
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');
}
错误信息:
SCRIPT5007: Unable to get value of the property 'apply': object is null or undefined
这样的事情应该有所帮助....
未测试
function checkPermissions(){
var ctx = new SP.ClientContext.get_current();
var oBooksList = ctx.get_web().get_lists().getByTitle('test Repository');
var listItem = oBooksList.getItemById(2);
var roles = listItem.get_roleAssignments();
ctx.load(roles);
ctx.executeQueryAsync(
// success
function (sender, args){
var roleInfo = '';
var roleEnumerator = roles.getEnumerator();
// enumerate the roles
while (roleEnumerator.moveNext()) {
var role = roleEnumerator.get_current();
var principal = role.get_member();
// get the principal
ctx.load(principal);
ctx.executeQueryAsync(
// success
function (sender, args){
// alert the title
alert(principal.get_title());
},
// failure
function (sender, args){
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
});
}
},
// failure
function (sender, args){
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
});
}
我在 Sharepoint 中检查列表项权限的功能似乎不起作用。它位于 Sharepoint 2010 站点上的 aspx 文件中。我在尝试 运行 时收到以下错误消息。有谁知道应该怎么做?我在 C# 中找到了很多相同函数的示例,但在 Javascript 中找不到任何内容。谢谢!
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');
}
错误信息:
SCRIPT5007: Unable to get value of the property 'apply': object is null or undefined
这样的事情应该有所帮助....
未测试
function checkPermissions(){
var ctx = new SP.ClientContext.get_current();
var oBooksList = ctx.get_web().get_lists().getByTitle('test Repository');
var listItem = oBooksList.getItemById(2);
var roles = listItem.get_roleAssignments();
ctx.load(roles);
ctx.executeQueryAsync(
// success
function (sender, args){
var roleInfo = '';
var roleEnumerator = roles.getEnumerator();
// enumerate the roles
while (roleEnumerator.moveNext()) {
var role = roleEnumerator.get_current();
var principal = role.get_member();
// get the principal
ctx.load(principal);
ctx.executeQueryAsync(
// success
function (sender, args){
// alert the title
alert(principal.get_title());
},
// failure
function (sender, args){
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
});
}
},
// failure
function (sender, args){
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
});
}