Reputation: 31
I am rather confused but, as a new Google Apps user, I may do things wrongly.
I created a "mydomain.tld" domain and a "mygroup" google group on this domain.
This group contains email addresses which are not all @gmail.com or @domain.tld. All have been directly added (it is a student list for a school)
I created a spreadsheet and added a script to the sheet to retrieve all the members of the group.
All is fine if I use the deprecated function : GroupsManager.getGroup("[email protected]").getAllMembers();
I only get a small part of the group members when I use the new API:
GroupsApp.getGroupByEmail("[email protected]").getUsers();
As far I can see I get all the gmail.com email addresses plus some emails from other domains too.
Many thanks in advance to let me know what I is wrong and how I could get all the email addresses of the group with the current API.
Upvotes: 2
Views: 1917
Reputation: 51
I too have been setting a group up to use as a distribution list. I added users by their email address (e.g. name@domain). Some use gmail and there was a mix of other domains too. When then downloading the members, some were not there and the distinction was not restricted to one or more domains. Some using hotmail, rogers etc were there and some were not.
I then realise that I noticed that some users had a 'proper name' in their group membership and others didn't. That also was not a distinction in the retrieved member list. However I wanted to use proper names for all members so hunted for a way to do it.
I had to delete the members and re-add them using 'proper name <email address>' instead of just the email address.
Once I had done that ALL members now show in the membership list or in scripted checks.
Upvotes: 0
Reputation: 31
I found a way to get the complete list of the addresses of a group using:
lMembers = AdminDirectory.Members.list(my_group_email).members
This requires to authorise the admin API in the Google Advanced Services menu of the script editor and the activation of the Admin SDK in Google dev console.
It works well if the user is the super admin of the domain but I have not managed yet to authorise non super admin users to use this function.
Any hint about where to look for would be appreciated.
Upvotes: 1
Reputation: 2143
The most likely answer here is that the addresses that aren't being returned are not real users, and are instead 'Groups' or Non-Google users.
My understanding is that in the old deprecated method, 'getAllMembers()' would literally list the emails of all members of the group, however, 'getUsers()' seems to just return actual Google accounts rather then just a list of all email address. As a result any nested groups won't return the second groups email address (as it's not a real user) and it also won't return the addresses of any Non-Google account that are listed in the group (as Google doesn't see them as 'Real Users').
Simple way to test = Check if the results that aren't being returned are group email addresses and/or Non-Gmail accounts such as Hotmail addresses.
If this is the case, and you want to feedback to Google on this, you can scroll down to the very bottom of the groups page and hit 'report an issue' under 'Connect'. This will open a dialogue box that will let you feed back to Google.
Upvotes: 0