-
Notifications
You must be signed in to change notification settings - Fork 88
Users People Contacts Profiles
- Notes
- API documentation
- Python Regular Expressions Match function
- Definitions
- Special quoting for contact groups
- Select User Contacts
- Create User Contacts
- Update User Contacts
- Delete User Contacts
- Clear Old Email Addresses From Contacts
- Delete Duplicate Email Addresses Within Contacts
- Replace Domain Names in Contact Email Addresses
- Display User Contacts
- Manage User Contact Photos
- Copy User Other Contacts to My Contacts
- Move User Other Contacts to My Contacts
- Update User Other Contacts
- Delete User Other Contacts
- Display User Other Contacts
- Manage User Contact Groups
- Display User Contact Groups
- Display User People Profile
- Copy User Contacts to another User
As of version 6.08.00
, GAM uses the People API to manage user contacts rather than the Contacts API.
Most commands will work unchanged but Google has completely changed how the data is presented. If you
have scripts that process the output from print contacts
for example, they will have to be changed.
You might want to keep an older version of GAM available so you can compare the output from the two versions and make adjustments as necessary.
If you manage contacts in the contact group "Other Contacts", you will need to use an older version, as the People API has very little support for this.
To use these commands you must add the People API
to your project and authorize the appropriate scopes:
-
Client Access
People API (supports readonly)
-
People Directory API - read only
.
-
Service Account Access
-
OAuth2 API
: https://www.googleapis.com/auth/userinfo.profile -
People API (supports readonly)
: https://www.googleapis.com/auth/contacts -
People API - Other Contacts - read only
: https://www.googleapis.com/auth/contacts.other.readonly -
People Directory API - read only
: https://www.googleapis.com/auth/directory.readonly
-
gam update project
gam oauth create
gam user [email protected] check serviceaccount
- https://developers.google.com/people/api/rest
- https://developers.google.com/people/contacts-api-migration
<JSONData> ::= (json [charset <Charset>] <String>) | (json file <FileName> [charset <Charset>]) |
<QueryContact> ::= <String>
<PeopleResourceName> ::= people/<String>
<PeopleResourceNameList> ::= "<PeopleResourceName>(,<PeopleResourceName>)*"
<PeopleResourceNameEntity> ::=
<PeopleResourceNameNameList> | <FileSelector> | <CSVFileSelector> | <CSVDataSelector>
See: https://github.com/taers232c/GAMADV-XTD3/wiki/Collections-of-Items
<PeopleContactGroupName> ::= <String>
<PeopleContactGroupResourceName> ::= (contactgroup/<String>)|<String>
<PeopleContactGroupItem> ::= <PeopleContactGroupResourceName>|<PeopleContactGroupName>
<PeopleContactGroupList> ::= "<PeopleContactGroupItem>(,<PeopleContactGroupItem>)*"
<PeopleContactGroupEntity> ::=
<PeopleContactGroupList> | <FileSelector> | <CSVkmdSelector> | <CSVDataSelector>
See: https://github.com/taers232c/GAMADV-XTD3/wiki/Collections-of-Items
<PeopleUserContactSelection> ::=
[(selectcontactgroup <PeopleContactGroupItem>)|
[query <QueryContact>]]
[emailmatchpattern <RegularExpression> [emailmatchtype work|home|other|<String>]]
<PeoplePrintShowUserContactSelection> ::=
[(selectcontactgroup <PeopleContactGroupItem>)|(filtercontactgroup <PeopleContactGroupItem>)|
([query <QueryContact>] [selectmaincontacts|selectothercontacts])]
[emailmatchpattern <RegularExpression> [emailmatchtype work|home|other|<String>]]
<PeopleContactAttribute> ::=
(additionalname|middlename <String>)|
(address clear|(work|home|other|<String> ((formatted|unstructured <String>)|(streetaddress <String>)|(pobox <String>)|
(neighborhood <String>)|(locality <String>)|(region <String>)|(postalcode <String>)|(country <String>))* notprimary|primary))|
(billinginfo <String>)|
(biography|biographies <String>|(file <FileName> [charset <Charset>])|(gdoc <UserGoogleDoc>))|
(birthday <Date>)|
(calendar clear|(work|home|free-busy|<String> <URL> notprimary|primary))|
(clientdata <String> <String>)|
(directoryserver <String>)|
(email clear|(work|home|other|<String> <EmailAddress> notprimary|primary))|
(event clear|(anniversary|other|<String> <Date>))|
(externalid clear|(account|customer|network|organization|<String> <String>))|
(familyname|lastname <String>)|
(fileas <String>)|
(gender female|male)|
(givenname|firstname <String>)|
(im clear|(work|home|other|<String> aim|gtalk|icq|jabber|msn|net_meeting|qq|skype|yahoo <String> notprimary|primary))|
(interests clear|<String>)|
(initials <String>)|
(jot clear|(work|home|other|keywords|user> <String>))|
<JSONData>|
(language <Language>)|
(locale clear|<Language>)|
(location clear|<String>)|
(maidenname <String>)|
(mileage <String>)|
(name <String>)|
(nickname <String>)|
(note <String>|(file <FileName> [charset <Charset>])|(gdoc <UserGoogleDoc>))|
(occupation clear|<String>)|
(organization clear|(work|other|<String> <String> ((location <String>)|(department <String>)|(title <String>)|(jobdescription <String>)|(symbol <String>))* notprimary|primary))|
(phone clear|(work|home|other|fax|work_fax|home_fax|other_fax|main|company_main|assistant|mobile|work_mobile|pager|work_pager|car|radio|callback|isdn|telex|tty_tdd|<String> <String> notprimary|primary))|
(prefix <String>)|
(priority low|normal|high)
(relation clear|(spouse|child|mother|father|parent|brother|sister|friend|relative|domestic_partner|manager|assistant|referred_by|partner|<String> <String>))|
(sensitivity confidential|normal|personal|private)
(shortname <String>)|
(skills clear|<String>)|
(subject <String>)|
(suffix <String>)|
(userdefinedfield clear|(<String> <String>))|
(url|website clear|(app_install_page|blog|ftp|home|home_page|other|profile|reservations|work|<String> <URL> notprimary|primary))
For address, email, phone and url, the type <String> can be empty.
address "" formatted "My Address" primary
email "" [email protected] primary
phone "" "510-555-1212" primary
url "" "https://www.domain.com" primary
<PeopleFieldName> ::=
addresses|
ageranges|
biographies|
birthdays|
calendarurls|
clientdata|
coverphotos|
emailaddresses|
events|
externalids|
genders|
imclients|
interests|
locales|
locations|
memberships|
metadata|
misckeywords|
names|
nicknames|
occupations|
organizations|
phonenumbers|
photos|
relations|
sipaddresses|
skills|
urls|
updated|updatetime|
userdefined
<PeopleFieldNameList> ::= "<PeopleFieldName>(,<PeopleFieldName>)*"
<PeopleContactGroupAttribute> ::=
(clientdata <String> <String>)|
<JSONData>|
name <String>
<PeopleContactGroupFieldName> ::=
clientdata|
grouptype|
membercount|
metadata|
name
<PeopleContactGroupFieldNameList> ::= "<PeopleContactGroupFieldName>(,<PeopleContactGroupFieldName>)*"
<OtherContactsResourceName> ::= otherContacts/<String>
<OtherContactsResourceNameList> ::= "<OtherContactsResourceName>(,<OtherContactsResourceName>)*"
<OtherContactsResourceNameEntity> ::=
<OtherContactsResourceNameList> | <FileSelector> | <CSVFileSelector> | <CSVDataSelector>
See: https://github.com/taers232c/GAMADV-XTD3/wiki/Collections-of-Items
<OtherContactsSelection> ::=
[query <QueryContact>]
[emailmatchpattern <RegularExpression> [emailmatchtype work|home|other|<String>]]
<OtherContactsFieldName> ::=
emailaddresses|
metadata|
names|
phonenumbers|
photos
<OtherContactsFieldNameList> ::= "<OtherContactsFieldName>(,<OtherContactsFieldName>)*"
As contact group names can contain spaces, some care must be used when entering <ContactGroupList>
and <ContactEntity>
.
Suppose you enter the command gam info contactgroup "Sales Contacts"
The shell strips the "
leaving a single argument Sales Contacts
; as gam is expecting a list, it splits the argument on space leaving two items and then tries to process Sales
and Contacts
, not what you want.
You must enter: gam info contactgroups "'Sales Contacts'"
The shell strips the "
leaving a single argument 'Sales Contacts'
; as gam is expecting a list, it splits the argument on space while honoring the '
leaving one item Sales Contacts
and correctly processes the item.
For multiple names you must enter: gam info contactgroup "'Sales Contacts','Tech Contacts'"
You specify contacts by ID or by selection qualifiers.
<PeopleUserContactSelection> ::=
[(selectcontactgroup <PeopleContactGroupItem>)|
(query <QueryContact>)]
[emailmatchpattern <RegularExpression> [emailmatchtype work|home|other|<String>]]
Selections processed by People API
-
selectcontactgroup <PeopleContactGroupItem>
- Specify a specific contact group -
query <QueryContact>
- Fulltext query on contacts data fields. See: https://developers.google.com/contacts/v3/reference#contacts-query-parameters-reference
Selections processed by GAM
-
emailmatchpattern <RegularExpression>
- Select contacts that have an email address matching<RegularExpression>
-
emailmatchpattern <RegularExpression> emailmatchtype work|home|other|<String>
- Select contacts that have an email address matching<RegularExpression>
and a specific type -
emailmatchpattern ".*" emailmatchtype work|home|other|<String>
- Select contacts that have any email address with a specific type
<PeoplePrintShowUserContactSelection> ::=
[(selectcontactgroup <PeopleContactGroupItem>)|(filtercontactgroup <PeopleContactGroupItem>)|
([query <QueryContact>] [selectmaincontacts|selectothercontacts])]
[emailmatchpattern <RegularExpression> [emailmatchtype work|home|other|<String>]]
Selections processed by People API
-
selectcontactgroup <PeopleContactGroupItem>
- Specify a specific contact group; individual contacts downloaded -
query <QueryContact>
- Fulltext query on contacts data fields. See: https://developers.google.com/contacts/v3/reference#contacts-query-parameters-reference -
selectmaincontacts
- Specify "Contacts" -
selectothercontacts
- Specify "Other Contacts"
Selections processed by GAM
-
filtercontactgroup <PeopleContactGroupItem>
- Specify a specific contact group; all contacts downloaded, then filtered -
emailmatchpattern <RegularExpression>
- Select contacts that have an email address matching<RegularExpression>
-
emailmatchpattern <RegularExpression> emailmatchtype work|home|other|<String>
- Select contacts that have an email address matching<RegularExpression>
and a specific type -
emailmatchpattern ".*" emailmatchtype work|home|other|<String>
- Select contacts that have any email address with a specific type
When selectcontactgroup <PeopleContactGroupItem>
is used in these commands, GAM makes an API call
to get the list of contacts in <PeopleContactGroupItem>
and then makes an API call per contact to get the details; this may exceed quota limits.
When filtercontactgroup <PeopleContactGroupItem>
is used, GAM makes an API call to get all contacts and
then filters the list to only those in <PeopleContactGroupItem>
; quota limits should not apply.
gam <UserTypeEntity> create contact
[<PeopleContactAttribute>+]
(contactgroup <PeopleContactGroupItem>)*
[(csv [todrive <ToDriveAttribute>*] (addcsvdata <FieldName> <String>)*))| returnidonly]
You may specify zero or more contact groups with (contactgroup <PeopleContactGroupItem>)*
;
these contact groups define the complete contact group list for the contact.
By default, the user name and contact ID are displayed on stdout.
-
csv [todrive <ToDriveAttribute>*]
- Write user name and contact ID values to a CSV file.-
addcsvdata <FieldName> <String>
- Add additional columns of data from the command line to the output
-
-
returnidonly
- Display just the contact ID on stdout
To retrieve the contact ID with returnidonly
:
Linux/MacOS
contactId=$(gam user [email protected] create contact ... returnidonly)
Windows PowerShell
$contactId = & gam user [email protected] create contact ... returnidonly
gam <UserTypeEntity> update contacts
<PeopleResourceNameEntity>|(<PeopleUserContactSelection> endquery)
[<PeopleContactAttribute>+]
(contactgroup <PeopleContactGroupItem>)*|((addcontactgroup <PeopleContactGroupItem>)* (removecontactgroup <PeopleContactGroupItem>)*)
User contacts may be assigned to Contact Groups or may be unassigned and appear under My Contacts. The People API
allows selection of contacts by Contact Group; in Gam you specify selectcontactgroup <PeopleContactGroupItem>
. However, the API
does not allow selection of contacts from the Other Contacts section.
You may specify zero or more contact groups with (contactgroup <PeopleContactGroupItem>)*
;
these contact groups define the complete contact group list for the contact.
You may specify zero or more contact groups with (addcontactgroup <PeopleContactGroupItem>)*
;
these contact groups will be added to the current contact group list for the contact.
You may specify zero or more contact groups with (removecontactgroup <PeopleContactGroupItem>)*
;
these contact groups will be removed from the current contact group list for the contact.
When contactgroup
is specified, addcontactgroup
and removecontactgroup
are ignored.
You can clear all contact groups from a contact with contactgroup clear
.
gam <UserTypeEntity> delete contacts
<PeopleResourceNameEntity>|<PeopleUserContactSelection>
User contacts may be assigned to Contact Groups or may be unassigned and appear under My Contacts. The People API
allows selection of contacts by Contact Group; in Gam you specify selectcontactgroup <PeopleContactGroupItem>
. However, the API
does not allow selection of contacts from the Other Contacts section.
gam <UserTypeEntity> clear contacts
<PeopleResourceNameEntity>|<PeopleUserContactSelection>
[emailclearpattern <RegularExpression>] [emailcleartype work|home|other|<String>]
[delete_cleared_contacts_with_no_emails]
Typically, you would select contacts by emailmatchpattern <RegularExpression>
(and optionally emailmatchtype work|home|other|<String>
),
then the matching email addresses will be cleared from the user's contact's email list. The contact itself is updated, not deleted.
Email addresses that don't match will be unaffected. If you want to clear all email addresses of a particular type,
use emailmatchpattern ".*" emailmatchtype work|home|other|<String>
.
You can specify emailclearpattern <RegularExpression>
(and optionally emailcleartype work|home|other|<String>
) if you want to
clear email addresses other than the ones used to match the contacts or if you specify <PeopleResourceNameEntity>
.
A contact may contain no email addresses after matching email addresses are cleared. If you do not want to keep contacts with no
email addresses after clearing, use the delete_cleared_contacts_with_no_emails
option and they will be deleted.
Contacts with no email addresses before clearing will not be affected.
For example, you want to eliminate any contact email addresses that use your company's old domain name.
First, do show contacts emailmatchpattern "<RegularExpression>"
to verify that you're getting the right contacts.
Then do clear contacts emailmatchpattern "<RegularExpression>"
to clear the email addresses.
gam user [email protected] show contacts emailmatchpattern ".*@olddomain.com" fields email
gam user [email protected] clear contacts emailmatchpattern ".*@olddomain.com"
If the same email address appears multiple times within a contact, all but the first will be deleted.
gam <UserTypeEntity> dedup contacts
[<PeopleResourceNameEntity>|<PeopleUserContactSelection>]
[matchType [<Boolean>]]
If neither <PeopleResourceNameEntity>
or <PeopleUserContactSelection>
is specified, all contacts are checked for duplicates.
By default, the email type work|home|other|<String>
is ignored, all duplicates, regardless of type,
will be deleted. If matchtype
is true, only duplicate email addresses with the same type will be deleted.
This command replaces domain names in contact email addresses; this can be useful
when merging/renaming domains; multiple domain <OldDomainName> <NewDomainName>
options can be specified.
gam <UserTypeEntity> replacedomain contacts
[<PeopleResourceNameEntity>|<PeopleUserContactSelection>]
(domain <OldDomainName> <NewDomainName>)+
If neither <PeopleResourceNameEntity>
or <PeopleUserContactSelection>
is specified, all contact email addresses are updated
as applicable.
If <PeopleUserContactSelection>
specifies emailmatchpattern <RegularExpression>
, only email addresses within the contact that match <RegularExpression>
are updated.
In the following commands, specifying allfields
or including memberships
in fields <PeopleFieldNameList>
yields contact group information but only gives the contact group ID. Use the showgroups
option to have GAM
make additional API calls to get the contact group name associated with the ID.
gam <UserTypeEntity> info contacts
<PeopleResourceNameEntity>
[allfields|(fields <PeopleFieldNameList>)] [showgroups] [showmetadata]
[formatjson]
By default, Gam displays the fields names,emailaddresses,phonenumbers
.
-
allfields|(fields <PeopleFieldNameList>)
- Select fields to display
By default, Gam displays the information as an indented list of keys and values.
-
formatjson
- Display the fields in JSON format.
gam <UserTypeEntity> show contacts
<PeoplePrintShowUserContactSelection>
[orderby firstname|lastname|(lastmodified ascending)|(lastnodified descending)
[countsonly|allfields|(fields <PeopleFieldNameList>)] [showgroups] [showmetadata]
[formatjson]
By default, Gam displays all of a user's people contacts.
-
query <String>
- Display contacts based on the data in their fields A maximum of 10 contacts will be returned.orderBy
is not used withquery
.
By default, Gam displays the fields names,emailaddresses,phonenumbers
.
-
allfields|(fields <PeopleFieldNameList>)
- Select fields to display
By default, Gam displays the information as an indented list of keys and values.
-
formatjson
- Display the fields in JSON format.
gam <UserTypeEntity> print contacts [todrive <ToDriveAttribute>*]
<PeoplePrintShowUserContactSelection>
[orderby firstname|lastname|(lastmodified ascending)|(lastnodified descending)
[countsonly|allfields|(fields <PeopleFieldNameList>)] [showgroups] [showmetadata]
[formatjson [quotechar <Character>]]
By default, Gam displays all of a user's people contacts.
-
query <String>
- Display contacts based on the data in their fields A maximum of 10 contacts will be returned.orderBy
is not used withquery
.
By default, Gam displays the fields names,emailaddresses,phonenumbers
.
-
allfields|(fields <PeopleFieldNameList>)
- Select fields to display
By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format,
-
formatjson
- Display the fields in JSON format.
By default, when writing CSV files, Gam uses a quote character of double quote "
. The quote character is used to enclose columns that contain
the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled.
When using the formatjson
option, double quotes are used extensively in the data resulting in hard to read/process output.
The quotechar <Character>
option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output.
quotechar
defaults to gam.cfg/csv_output_quote_char
. When uploading CSV files to Google, double quote "
should be used.
gam <UserTypeEntity> update contactphotos
<PeopleResourceNameEntity>|<PeopleUserContactSelection>
[drivedir|(sourcefolder <FilePath>)] [filename <FileNamePattern>]
gam <UserTypeEntity> get contactphotos
<PeopleResourceNameEntity>|<PeopleUserContactSelection>
[drivedir|(targetfolder <FilePath>)] [filename <FileNamePattern>]
gam <UserTypeEntity> delete contactphotos
<PeopleResourceNameEntity>|<PeopleUserContactSelection>
The default directory is the current working directory, drivedir
specifies the value of drive_dir from gam.cfg and
sourcefolder/targetfolder <FilePath>
specifies a user-chosen path.
<FileNamePattern>
can contain the strings #email#
and #contactid#
which will be replaced by the the contact's primary emailaddress or the contact ID.
If not specified, <FileNamePattern>
defaults to #contactid#.jpg
.
Copy Other Contacts to My Contacts; now you have the same contact in two places.
gam <UserTypeEntity> copy othercontacts
<OtherContactsResourceNameEntity>|<OtherContactsSelection>
Move Other Contacts to My Contacts; there is no duplication.
gam <UserTypeEntity> move othercontacts
<OtherContactsResourceNameEntity>|<OtherContactsSelection>
Move a single Other Contact to My Contacts.
gam user [email protected] move othercontacts otherContacts/c5977555358312178721
User: [email protected], Move maximum of 1 Other Contact
User: [email protected], Other Contact: otherContacts/c5977555358312178721, Moved to: My Contacts
Move a selection of Other Contacts to My Contacts.
gam user [email protected] move othercontacts emailmatchpattern "test.*"
Getting all Other Contacts for [email protected]
Got 15 Other Contacts...
User: [email protected], Move maximum of 15 Other Contacts
User: [email protected], Other Contact: otherContacts/c2813750813749807666, Moved to: My Contacts
User: [email protected], Other Contact: otherContacts/c7887232007947329156, Moved to: My Contacts
User: [email protected], Other Contact: otherContacts/c523029179688316095, Moved to: My Contacts
User: [email protected], Other Contact: otherContacts/c4889739431064427541, Moved to: My Contacts
User: [email protected], Other Contact: otherContacts/c6318452176100245073, Moved to: My Contacts
Other contacts are updated and moved to My Contacts and other contact groups if specified.
gam <UserTypeEntity> update othercontacts
<OtherContactsResourceNameEntity>|<OtherContactsSelection>
[<PeopleContactAttribute>+]
(contactgroup <ContactGroupItem>)*
Update a single Other Contact and move to My Contacts and contact group "Test".
gam user [email protected] update othercontacts otherContacts/c5977555358312178721 contactgroup Test
User: [email protected], Copy maximum of 1 Other Contact
User: [email protected], Other Contact: otherContacts/c5977555358312178721, Updated/Moved to: My Contacts,Test
Update a selection of Other Contacts and move to My Contacts and contact group "Test".
gam user [email protected] update othercontacts emailmatchpattern "test.*" contactgroup Test
Getting all Other Contacts for [email protected]
Got 15 Other Contacts...
User: [email protected], Copy maximum of 15 Other Contacts
User: [email protected], Other Contact: otherContacts/c2813750813749807666, Updated/Moved to: My Contacts,Test
User: [email protected], Other Contact: otherContacts/c7887232007947329156, Updated/Moved to: My Contacts,Test
User: [email protected], Other Contact: otherContacts/c523029179688316095, Updated/Moved to: My Contacts,Test
User: [email protected], Other Contact: otherContacts/c4889739431064427541, Updated/Moved to: My Contacts,Test
User: [email protected], Other Contact: otherContacts/c6318452176100245073, Updated/Moved to: My Contacts,Test
Other contacts are deleted by moving them to My Contacts and deleting them from there.
gam <UserTypeEntity> delete othercontacts
<OtherContactsResourceNameEntity>|<OtherContactsSelection>
Delete a single Other Contact.
gam user [email protected] delete othercontacts otherContacts/c5977555358312178721
User: [email protected], Delete maximum of 1 Other Contact
User: [email protected], Other Contact: otherContacts/c5977555358312178721, Deleted
Delete a selection of Other Contacts.
gam user [email protected] delete othercontacts emailmatchpattern "test.*"
Getting all Other Contacts for [email protected]
Got 15 Other Contacts...
User: [email protected], Delete maximum of 15 Other Contacts
User: [email protected], Other Contact: otherContacts/c2813750813749807666, Deleted
User: [email protected], Other Contact: otherContacts/c7887232007947329156, Deleted
User: [email protected], Other Contact: otherContacts/c523029179688316095, Deleted
User: [email protected], Other Contact: otherContacts/c4889739431064427541, Deleted
User: [email protected], Other Contact: otherContacts/c6318452176100245073, Deleted
gam <UserTypeEntity> show othercontacts
[<OtherContactsSelection>]
[countsonly|allfields|(fields <OtherContactsFieldNameList>)] [showmetadata]
[formatjson]
By default, Gam displays all of a user's Other Contacts; use
<OtherContactsSelection>
to display a selection of Other Contacts.
By default, Gam displays the fields names,emailaddresses,phonenumbers
.
-
allfields|(fields <PeopleFieldNameList>)
- Select fields to display
By default, Gam displays the information as an indented list of keys and values.
-
formatjson
- Display the fields in JSON format.
gam <UserTypeEntity> print othercontacts [todrive <ToDriveAttribute>*]
[<OtherContactsSelection>]
[countsonly|allfields|(fields <OtherContactsFieldNameList>)] [showmetadata]
[formatjson [quotechar <Character>]]
By default, Gam displays all of a user's Other Contacts; use
<OtherContactsSelection>
to display a selection of Other Contacts.
By default, Gam displays the fields names,emailaddresses,phonenumbers
.
-
allfields|(fields <PeopleFieldNameList>)
- Select fields to display
By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format,
-
formatjson
- Display the fields in JSON format.
By default, when writing CSV files, Gam uses a quote character of double quote "
. The quote character is used to enclose columns that contain
the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled.
When using the formatjson
option, double quotes are used extensively in the data resulting in hard to read/process output.
The quotechar <Character>
option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output.
quotechar
defaults to gam.cfg/csv_output_quote_char
. When uploading CSV files to Google, double quote "
should be used.
gam <UserTypeEntity> create contactgroup <PeopleContactGroupAttribute>+
[(csv [todrive <ToDriveAttribute>*] (addcsvdata <FieldName> <String>)*))| returnidonly]
By default, the user name and contactgroup ID are displayed on stdout.
-
csv [todrive <ToDriveAttribute>*]
- Write user name and contactgroup ID values to a CSV file.-
addcsvdata <FieldName> <String>
- Add additional columns of data from the command line to the output
-
-
returnidonly
- Display just the contactgroup ID on stdout
To retrieve the contactgroup ID with returnidonly
:
Linux/MacOS
contactGroupId=$(gam user [email protected] create contactgroup ... returnidonly)
Windows PowerShell
$contactGroupId = & gam user [email protected] create contactgroup ... returnidonly
gam <UserTypeEntity> update contactgroup <PeopleContactGroupItem> <PeopleContactGroupAttribute>+
gam <UserTypeEntity> delete contactgroups <PeopleContactGroupEntity>
gam <UserTypeEntity> info contactgroups <PeopleContactGroupEntity>
[allfields|(fields <PeopleContactGroupFieldList>)] [showmetadata]
[formatjson]
gam <UserTypeEntity> show contactgroups
[allfields|(fields <PeopleContactGroupFieldNameList>)] [showmetadata]
[formatjson]
By default, Gam displays the fields name,metadata,grouptype,membercount
.
-
allfields|(fields <PeopleContactGroupFieldNameList>)
- Select fields to display
By default, Gam displays the information as an indented list of keys and values.
-
formatjson
- Display the fields in JSON format.
gam <UserTypeEntity> print contactgroups [todrive <ToDriveAttribute>*]
[allfields|(fields <PeopleContactGroupFieldNameList>)] [showmetadata]
[formatjson [quotechar <Character>]]
By default, Gam displays the fields name,metadata,grouptype,membercount
.
-
allfields|(fields <PeopleContactGroupFieldNameList>)
- Select fields to display
By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format,
-
formatjson
- Display the fields in JSON format.
By default, when writing CSV files, Gam uses a quote character of double quote "
. The quote character is used to enclose columns that contain
the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled.
When using the formatjson
option, double quotes are used extensively in the data resulting in hard to read/process output.
The quotechar <Character>
option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output.
quotechar
defaults to gam.cfg/csv_output_quote_char
. When uploading CSV files to Google, double quote "
should be used.
gam <UserTypeEntity> show peopleprofile
[allfields|(fields <PeopleFieldNameList>]) [showmetadata]
[formatjson]
By default, Gam displays the fields names,emailaddresses,phonenumbers
.
-
allfields|(fields <PeopleFieldNameList>)
- Select fields to display
By default, Gam displays the information as an indented list of keys and values.
-
formatjson
- Display the fields in JSON format.
gam <UserTypeEntity> print peopleprofile [todrive <ToDriveAttribute>*]
[allfields|(fields <PeopleFieldNameList>)] [showmetadata]
[formatjson [quotechar <Character>]]
By default, Gam displays the fields names,emailaddresses,phonenumbers
.
-
allfields|(fields <PeopleFieldNameList>)
- Select fields to display
By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format,
-
formatjson
- Display the fields in JSON format.
By default, when writing CSV files, Gam uses a quote character of double quote "
. The quote character is used to enclose columns that contain
the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled.
When using the formatjson
option, double quotes are used extensively in the data resulting in hard to read/process output.
The quotechar <Character>
option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output.
quotechar
defaults to gam.cfg/csv_output_quote_char
. When uploading CSV files to Google, double quote "
should be used.
To copy one user's contacts to another user perform the following steps.
# Copy contact groups
gam redirect csv ./ContactGroups.csv user [email protected] print contactgroups formatjson
gam redirect stdout ./CopyContactGroups.txt multiprocess redirect stderr stdout csv ContactGroups.csv gam user [email protected] create contactgroup json "~JSON"
# Copy contacts
gam redirect csv ./Contacts.csv user [email protected] print contacts selectmaincontacts allfields showgroups formatjson
gam redirect stdout ./CopyContacts.txt multiprocess redirect stderr stdout csv Contacts.csv gam user [email protected] create contact json "~JSON"
Need more help? Ask on the GAM Discussion Group
Update History
Installation
- How to Install GAM7
- How to Uograde GAMADV-XTD3 to GAM7
- How to Upgrade Legacy GAM to GAM7
- How to Update GAM7
- Install GAM as Python Library
- GAM7 on Chrome OS Devices
- GAM7 on Android Devices
- Google Network Addresses
- HTTPS Proxy
- SSL Root CA Certificates
- How to Uninstall GAM7
Configuration
- Authorization
- GAM Configuration
- Running GAM7 securely on a Google Compute Engine
- Using GAM7 with a delegated admin service account
- Using GAM7 with a YubiKey
Notes and Information
- Upgrade Benefits
- Questions? Visit the GAM Discussion Forum
- GAM Public Chat Room
- Scripts
- Other Resources
- Drive REST API v3
- BNF Syntax
- GAM Return Codes
- Python Regular Expressions
- Rclone
Definitions
Command Processing
- Bulk Processing
- Command Line Parsing
- Command Logging and Progress
- Command data from Google Docs/Sheets/Storage
- CSV Special Characters
- CSV Input Filtering
- CSV Output Filtering
- Meta Commands and File Redirection
- Permission matches
- Tag Replace
- Todrive
Collections
Client Access
- Addresses
- Administrators
- Alert Center
- Aliases
- Calendars
- Calendars - Access
- Calendars - Events
- Chrome Auto Update Expiration Counts
- Chrome Browser Cloud Management
- Chrome Device Needs Attention Counts
- Chrome Installed Apps
- Chrome Policies
- Chrome Printers
- Chrome Profile Management
- Chrome Version Counts
- Chrome Version History
- ChromeOS Devices
- Classroom - Courses
- Classroom - Guardians
- Classroom - Invitations
- Classroom - Membership
- Cloud Channel
- Cloud Identity Devices
- Cloud Identity Groups
- Cloud Identity Groups - Membership
- Cloud Identity Policies
- Cloud Storage
- Context Aware Access Levels
- Customer
- Domains
- Domains - Verification
- Domain People - Contacts & Profiles
- Domain Shared Contacts - Global Address List
- Email Audit Monitor
- Find File Owner
- Google Data Transfers
- Groups
- Groups - Membership
- Inbound SSO
- Licenses
- Mobile Devices
- Organizational Units
- Reports
- Reseller
- Resources
- Send Email
- Schemas
- Shared Drives
- Sites
- Users
- Unmanaged Accounts
- Users - Signout and Turn off 2-Step Verification
- Vault - Takeout
- Version and Help
Special Service Account Access
Service Account Access
- Users - Analytics Admin
- Users - Application Specific Passwords
- Users - Backup Verification Codes
- Users - Calendars
- Users - Calendars - Access
- Users - Calendars - Events
- Users - Chat
- Users - Classification Labels
- Users - Classroom - Profile
- Users - Deprovision
- Users - Contacts
- Users - Contacts - Delegates
- Users - Drive - File Selection
- Users - Drive - Activity/Settings
- Users - Drive - Cleanup
- Users - Drive - Comments
- Users - Drive - Copy/Move
- Users - Drive - Files-Display
- Users - Drive - Files-Manage
- Users - Drive - Orphans
- Users - Drive - Ownership
- Users - Drive - Permissions
- Users - Drive - Query
- Users - Drive - Revisions
- Users - Drive - Shortcuts
- Users - Drive - Transfer
- Users - Forms
- Users - Gmail - Client Side Encryption
- Users - Gmail - Delegates
- Users - Gmail - Filters
- Users - Gmail - Forwarding
- Users - Gmail - Labels
- Users - Gmail - Messages/Threads
- Users - Gmail - Profile
- Users - Gmail - S/MIME
- Users - Gmail - SendAs/Signature/Vacation
- Users - Gmail - Settings
- Users - Group Membership
- Users - Keep
- Users - Looker Studio
- Users - Meet
- Users - Classroom - Profile
- Users - People - Contacts & Profiles
- Users - Photo
- Users - Profile Sharing
- Users - Shared Drives
- Users - Spreadsheets
- Users - Tasks
- Users - Tokens
- Users - YouTube