Welcome to the Smartsheet Forum Archives

The posts in this forum are no longer monitored for accuracy and their content may no longer be current. If there's a discussion here that interests you and you'd like to find (or create) a more current version, please Visit the Current Forums.

Getting GroupMembers of Group using JavaSDK, Smartsheet API

Chris Be
Chris Be
edited 12/09/19 in Archived 2017 Posts

Hey Community!


I'm stuck at a certain point in my development process. I need to receive a list of all GroupMembers of a Group in Smartsheet. I tried the following:


//First, getting all groups of our smartsheet plan and storing the result in variable grouplist

//Iterate through all Groups...


for (Group g : grouplist) {


                // getMembers() returns a List of GroupMembers.
               // If the list is not null, print out all email-adresses of groupmembers
                if (g.getMembers() != null) {
                    for (GroupMember member : g.getMembers()) {
                } else {
                    System.out.println("No Group Members");


As an output I receive the following:


No Members found
No Members found
No Members found
No Members found
No Members found
No Members found
No Members found
No Members found
No Members found


It seems like the function of Group object "getMembers()" always returns null in my case, says I'm always receiving an empty list of GroupMembers. This can't be because all groups got members for sure. Also if I print out other group details like owner, id, ... everything works fine, just the getMembers() function is not working for me, returns always null.


Am I doing something wrong? Is the function getMembers() not working correctly?


Thanks for your support






  • Steve Weil
    Steve Weil Employee

    The listGroups() call returns 'lightweight' group objects that only contain a subset of properties. You'll need to call getGroup() to retrieve the full list of members.


    This is a common pattern in our API (and others) but can be confusing. It's required for performance and to reduce the amount of data retrieved and sent over the wire. If you look closely at the example response in the API docs you can see exactly what is returned.


    My code looks like this:

         PaginationParameters parameters = new PaginationParameters.PaginationParametersBuilder().setIncludeAll(true).build();
    PagedResult<Group> groups = ss.groupResources().listGroups(parameters);
    for (Group groupSummary : groups.getData()) {
    Group groupWithDetails = ss.groupResources().getGroup(groupSummary.getId());
    List<GroupMember> members = groupWithDetails.getMembers();
    for (GroupMember m : members) {
    String s = m.getEmail();
  • Hey Steve!


    Thanks a lot for your reply!


    Now I see what's going on here! Your code snippet works brilliant and all members are now displayed.


    Thank you very much for your support!



This discussion has been closed.