我正在尝试使用 javascript 对象模型来检索列表的用户/组列表及其在列表级别的权限。到目前为止,我有这个返回一个成员对象,但我无法获得有关该成员的任何信息。当我尝试使用 rAssignment.get_member().get_id() 或 rAssignment.get_member().get_title() 时出现错误。
//Get List Permissions
function getListPerms() {
var clientContext = new SP.ClientContext();
var siteColl = clientContext.get_site();
var site = clientContext.get_web();
listSecurableObject = site.get_lists().getByTitle($("[name='ListSlct']").val());
listRoleAssignments = listSecurableObject.get_roleAssignments();
clientContext.load(listRoleAssignments);
clientContext.executeQueryAsync(Function.createDelegate(this, this.getListPerms_onQuerySucceeded),Function.createDelegate(this, this.getListPerms_onQueryFailed));
}
function getListPerms_onQuerySucceeded() {
var listPerms="";
listPerms += '<table border="1">';
listPerms += '<tr>';
listPerms += '<td align="center">ID</td>';
listPerms += '</tr>';
var listPermsEnumerator = this.listRoleAssignments.getEnumerator();
while (listPermsEnumerator.moveNext()) {
var rAssignment = listPermsEnumerator.get_current();
listPerms += '<tr>';
listPerms += '<td align="center">' + rAssignment.get_member() + '</td>';
listPerms += '</tr>';
}
listPerms += '</table>';
document.getElementById('listPermsTable').innerHTML = listPerms;
}
function getListPerms_onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}