function checkGroup(){
var clientContext = SP.ClientContext.get_current();
var web = clientContext.get_web();
var allGroups = web.get_siteGroups();
clientContext.load(allGroups);
clientContext.executeQueryAsync(function(){
var count = allGroups.get_count();
for(i = 0; i < count; i++){
var grp = allGroups.getItemAtIndex(i);
if(grp.get_loginName() == 'NDA_ADMINS'){
var groupUsers = grp.get_users();
clientContext.load(groupUsers);
clientContext.executeQueryAsync(function(){
userInGroup = false;
var groupUserEnumerator = groupUsers.getEnumerator();
while (groupUserEnumerator.moveNext()) {
var groupUser = groupUserEnumerator.get_current();
if(groupUser.get_title() == login) {
userInGroup = true;
console.log('user is in group');
break;
}
}
getProjects('');
},function(sender,args){
alert('Request failed' + args.get_message() + '\n' + args.get_stackTrace());
});
}
}
},function(sender,args){
alert('Request failed' + args.get_message() + '\n' + args.get_stackTrace());
});
}
我在这里收到错误:
var groupUsers = grp.get_users();
答案 0 :(得分:0)
用户是服务器场管理员吗?如果nott并且该组被设置为仅向其他成员显示成员,那么您将失去运气。