How to Select title field while displaying information

120 views
Skip to first unread message

Deepan Udaiyar

unread,
Feb 12, 2020, 2:07:43 AM2/12/20
to GAM for G Suite
Hi,

I am trying to extract following information for our org. 

Firstname
LastName
Job Title
Phone number (Primary)

I have been able to get most of info by using the following cmd. 

gam info user us...@example.com fields firstname lastname organization phone


First Name: Test

    Last Name: user

  Organizations:

    customType:

      title: IT Support

      primary: True

  Phones:

    type: work

      value: 123-456-7890



However , i only need the value of title from organization and phone number from phone field.. How can i get that ??




James SEYMOUR

unread,
Feb 12, 2020, 2:36:47 AM2/12/20
to GAM for G Suite
Hi Deepan,

I am sure there is a better/cleaner way to acheive this but I did check as best I could but could not see the option needed.  So until someone posts that, you can use this to view all the fields and then filter.

gam user <User Email Address> print allfields

There is a column for organizations.0.title which is what I think you are looking for.

Regards

James

Deepan Udaiyar

unread,
Feb 12, 2020, 2:25:56 PM2/12/20
to GAM for G Suite
Thanks James, that's exactly the field that i was looking for. However, how  do i filter the allfields to show only selected fields that i wanted ??

I would like to filter the fields before i export it a csv file ..

Thanks

James SEYMOUR

unread,
Feb 12, 2020, 5:25:00 PM2/12/20
to GAM for G Suite
Hi Deepan,

I did look to see if I could sort this out, but could not see the "field name" to use. But that is not to sau it can't be done, someone with more experiance than me may be able to sort it out.

James 

Ross Scroggs

unread,
Feb 12, 2020, 7:16:42 PM2/12/20
to google-ap...@googlegroups.com
Deepan,

If you are trying to do this for all users, here's what to do.
Advanced GAM, all platforms

$ gam config csv_output_header_filter primaryEmail,name.givenName,name.familyName,organizations.0.title,phones.0.value redirect csv ./UserInfo.csv print users fields firstname,lastname,organizations,phones


Basic GAM

Linux/MacOS

$ export GAM_CSV_HEADER_FILTER="primaryEmail,name.givenName,name.familyName,organizations.0.title,phones.0.value"

Windows Command Prompt

$ set GAM_CSV_HEADER_FILTER=primaryEmail,name.givenName,name.familyName,organizations.0.title,phones.0.value"


Both

$ gam print users fields firstname,lastname,organizations,phones > UserInfo.csv


Ross

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/8409d4a8-0d8b-4a98-a38f-30baad491d2e%40googlegroups.com.


--

James SEYMOUR

unread,
Feb 12, 2020, 9:03:08 PM2/12/20
to GAM for G Suite
Many thanks Ross.

For posterity I have added a section to my site here https://sites.google.com/jis.edu.bn/gam-commands/people/users#h.p_eX4yyhWCFbpO covering this.

Regards

James


On Thursday, 13 February 2020 08:16:42 UTC+8, Ross Scroggs wrote:
Deepan,

If you are trying to do this for all users, here's what to do.
Advanced GAM, all platforms

$ gam config csv_output_header_filter primaryEmail,name.givenName,name.familyName,organizations.0.title,phones.0.value redirect csv ./UserInfo.csv print users fields firstname,lastname,organizations,phones


Basic GAM

Linux/MacOS

$ export GAM_CSV_HEADER_FILTER="primaryEmail,name.givenName,name.familyName,organizations.0.title,phones.0.value"

Windows Command Prompt

$ set GAM_CSV_HEADER_FILTER=primaryEmail,name.givenName,name.familyName,organizations.0.title,phones.0.value"


Both

$ gam print users fields firstname,lastname,organizations,phones > UserInfo.csv


Ross

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.


--
Ross Scroggs
Reply all
Reply to author
Forward
0 new messages