Closed egenethebest closed 2 years ago
Send me a Meet/Zoom invitation and we can discuss.
Ross
On Fri, Jul 1, 2022 at 8:56 AM egenethebest @.***> wrote:
This is not a bug, just a little inefficiency that could possibly be improved upon.
When trying to retrieve the contacts from a specific contact group in the following manager: gam user
print contacts selectcontactgroup <User's Contact Group> Gam first retrieves all contacts of the user, then outputs only the contacts in that Contact Group Same situation if you want to only get the number of contacts in that contact group in the following maner: gam user print contacts selectcontactgroup <User's Contact Group> countsonly here is an example output I get for a user:
$ gam user user print contacts selectcontactgroup <User's Contact Group> countsonly Getting all People Contacts for @. Got 17742 People Contacts... User,People @.,319
It is not an issue for most users, since they only have a few contacts in their Google Contacts. However, for users with a lot of contacts such as this one it might take up to a whole minute to simply retrieve the number of contacts in a contact group. More over, (please do correct me if I am wrong) the extra contact reads count towards the API meaning that in this user's specific case I end up reading 17'742 contacts instead of 319
I am not sure how Google's new People API works. However if I understand correctly from here: https://developers.google.com/people/api/rest/v1/contactGroups/get
There is some way to only retrieve the contacts in a specific contact group only.
If this method is used the returned object is Resource: ContactGroup https://developers.google.com/people/api/rest/v1/contactGroups#ContactGroup which asside from the contacts also contains the number of contacts in the contact group.
I have tried looking from teh GAM sources, but I was not able to find the specific location from where the gam user
print contacts selectcontactgroup is called, so I am not sure what API querry it is at the moment. — Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/280, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYLYURWGDAFC2A7K4R43VR4IKHANCNFSM52NE3A2Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>
-- Ross Scroggs @.***
Fixed 6.24.12
Wow that was so quick!
I have just tried it out and the fix does indeed seem to work! Querying contact groups now takes less time for smaller groups and is not dependent on the total numer of contact thte user has.
One thing I have noticed is that calling:
$ gam user <user> print contacts selectcontactgroup <User's Contact Group> countsonly
Takes more time depending on how many contacts are in the specified contact group.
Which is expected, since you are probably using Google's API to query the contact group and Google might take longer to send a response with larger groups.
However, if all you want is the number of members in a contactGroup it is much more eficient to query:
$ gam user <user> print contactgroups
(which is practically instantaneous) and then filter for the 'memberCount' of the desired contactGroup.
I think that the way that GAM retrieves the countsonly is the correct way that it should be done. But I might change some of my personal scripts to use the faster way mentioned above (if I only need to retrieve the number of contacts in a contact group)
Unfortunately, the fix has also introduced a bug. For some reason I am no longer able to query contactGroups by their 'formattedName', I can query by their 'resourceName' without issues. Here is an example query:
$ gam user <user> print contacts selectcontactgroup <User's Contact Group formattedName> countsonly
Getting all People Contacts for <user>
ERROR: Parameter "resourceName" value "iSAMS_import_contacts" does not match the pattern "^contactGroups/[^/]+$"
According to the documentation, a PeopleContactGroupItem could either be a PeopleContactGroupResourceName or a PeopleContactGroupName: \<PeopleContactGroupName> ::= \<String> \<PeopleContactGroupResourceName> ::= (contactgroup/\<String>)|\<String> \<PeopleContactGroupItem> ::= \<PeopleContactGroupResourceName>|\<PeopleContactGroupName>
However, for some reason whenever I enter a a string, even one that does not start with "contactgroup/" GAM tries to interpret it as a 'PeopleContactGroupResourceName', after what validation fails giving me the error that the pattern does not match "^contactGroups/[^/]+$"
PS. Do you have a Patreon or something similar where people can buy you a coffee or a beer ?
Unfortunately, the fix has also introduced a bug. For some reason I am no longer able to query contactGroups by their 'formattedName', I can query by their 'resourceName' without issues.
Fixed 6.24.14
Just tested the latest version and the issue is gone.
Thank you very much for your hard work Ross! Really helping the Google Admin community!!!
This is not a bug, just a little inefficiency that could possibly be improved upon.
When trying to retrieve the contacts from a specific contact group in the following manager:
gam user <user> print contacts selectcontactgroup <User's Contact Group>
Gam first retrieves all contacts of the user, then outputs only the contacts in that Contact Group Same situation if you want to only get the number of contacts in that contact group in the following maner:gam user <user> print contacts selectcontactgroup <User's Contact Group> countsonly
here is an example output I get for a user:
It is not an issue for most users, since they only have a few contacts in their Google Contacts. However, for users with a lot of contacts such as this one it might take up to a whole minute to simply retrieve the number of contacts in a contact group. More over, (please do correct me if I am wrong) the extra contact reads count towards the API meaning that in this user's specific case I end up reading 17'742 contacts instead of 319
I am not sure how Google's new People API works. However if I understand correctly from here: https://developers.google.com/people/api/rest/v1/contactGroups/get There is some way to only retrieve the contacts in a specific contact group only.
If this method is used the returned object is Resource: ContactGroup which asside from the contacts also contains the number of contacts in the contact group.
I have tried looking from teh GAM sources, but I was not able to find the specific location from where the
gam user <user> print contacts selectcontactgroup
is called, so I am not sure what API querry it is at the moment.