Hi everyone,
Whenever I try to list all group members in cloud script is always returning only 2 members of a group, even that I have a lot of them already. this cloud script call is asked by the administrator of the group.
var group = { Id: args.groupId, Type: "group" }; try { var allStudents = entity.ListGroupMembers ( { Group: group }); } catch (e) { var msg = "Error: " + JSON.stringify(e); log.info(msg); return "error"; } return allStudents.Members.length;
In client code it returns fine, the issue is only in Cloud Script. Group ID as an example: BEE87EEE53CAE05B
Is this a bug? Am I missing something?
Answer by Junjin Chen · Jan 14 at 08:47 AM
This is not a bug. The ListGroupMembers API returns roles in the first layer, then under those roles, there will be actual members. Please refer to this API structure. If you change line 18 in your code snippet to “return allStudents.Members;”, you will be able to see the structure of your group.