gamadv-xtd -- Handling Middle Initials

29 views
Skip to first unread message

JasonF

unread,
Apr 17, 2019, 4:15:31 PM4/17/19
to GAM for G Suite
For a 'reason', I need to handle a middle initial for a user. The API does not seem to have the concept of middle initials (or middle-names). 

So, the reasonable solution is to use 'keywords.value.customtype.middlename'; this would work...

But I run into a problem that I have another 'keywords.value.custom.honorific'; well, by experimentation, writing the honorific then the middlename overwrite each other -- apparently only ONE custom keyword is allowed?

So, despite the "s" part of "keyword|keywords" as shown in the wiki and the API docs, you can't have multiple custom keywords?

Thoughts?

Thanks,
Jason 

background: 
Signatures are based upon an HTML template, and via scripting, user data from a csv is used to create a gam command to create the signature. The script, at one point, issues the clear (as above), which of course clears all keywords -- I'd rather be able to be more flexible and clear specific keywords.

The command to create the signature is '$HOME/bin/gamadv-xtd/gam user $uid signature file $sigfile html replace fname field:name.givenname replace lname field:name.familyname replace honorific field:keywords.value.customtype.honorific replace ou field:organization.name replace role field:organization.title replace direct field:phone.value.customtype.direct replace office field:phone.value.type.company_main replace extension field:phone.value.customtype.extension replace mobile field:phone.value.customtype.mobile"

I'd insert in there somewhere "replace midname field:keywords.value.customtype.midname".



Kevin Melillo ✉

unread,
Apr 17, 2019, 4:17:13 PM4/17/19
to google-ap...@googlegroups.com
We include the middle initial as the last part of the first name.

--
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 post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/f95bbfc5-9b95-4203-b096-e1c7ff01d4f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
photo
Kevin Melillo
Electronic Communications Analyst, Information Technology

Phone: 732.465.6609 | Mobile: 732-609-4331

Email: k.me...@ieee.org

445 Hoes Lane Piscataway, NJ 08854

Jason

unread,
Apr 17, 2019, 4:25:00 PM4/17/19
to google-ap...@googlegroups.com, Kevin Melillo ✉

Kevin, doesn't that automatically insert the middle initial into 'fullname' then?

Jason

Kevin Melillo ✉ wrote:

For more options, visit https://groups.google.com/d/optout.
--

#FarmerPower

farmobile.com Jason Forst   |   Farmobile
Director of Infrastructure
Direct: 913-766-4625
Office: 844-337-2255 x 725
Mobile: 913-481-7325

This email is strictly confidential. If you received this email in error please delete it immediately and notify the sender.

Ross Scroggs

unread,
Apr 17, 2019, 10:07:25 PM4/17/19
to google-ap...@googlegroups.com
Jason,

You can have multiple keywords, but the API requires that you supply all of them on each call.

Jason

unread,
Apr 18, 2019, 12:48:41 PM4/18/19
to GAM for G Suite

Hi Ross, I'll look at schemas too.

I've discovered a couple things about keywords (that you probably already know...):

1. Multiple custom keywords (keyword custom <keyword-name> <keyword-value>; and, <keyword-value> does not have to be double-quoted unless you are trying to set null ( "" )

2. To insert/add keywords, you must include them _all_ in the command:

$ gam update user uid@domain keyword custom honorific "Ph.D." keyword custom middlename "fred" keyword custom somefield "somevalue"

$ gam info user uid@domain keywords
  Keywords:
    type: custom
      customType: honorific
      value: Ph.D.
    type: custom
      customType: middlename
      value: fred
    type: custom
      customType: somefield
      value: somevalue
  Groups: (15)
<<snip>>

3. To update the values of keywords, you must include all the keywords and values in each command: i.e. leaving one (or more) out will delete that value (e.g. middle name is removed)

$ gam update user uid@domain keyword custom honorific "DSc." keyword custom somefield "anothervalue"

$ gam info user uid@domain keywords
  Keywords:
    type: custom
      customType: honorific
      value: DSc.
    type: custom
      customType: somefield
      value: anothervalue
  Groups: (15)
<<snip>>

4.  If all values are null ( "" ), then no keyword values will be changed:

$ gam update user uid@domain keyword custom honorific "" keyword custom somefield ""

$ gam info user uid@domain keywords
  Keywords:
    type: custom
      customType: honorific
      value: DSc.
    type: custom
      customType: somefield
      value: anothervalue
  Groups: (15)
<<snip>>

5. To set SOME values to "" (null) and thus remove the keyword, at least one must have a non-null value; the null-value keywords will be removed:

$ gam update user uid@domain keyword custom honorific "DDS" keyword custom somefield ""

$ gam info user uid@domain keywords
  Keywords:
    type: custom
      customType: honorific
      value: DDS
  Groups: (15)
<<snip>>
(Note, another approach here is to only include the desired keyword(s) and value(s), i.e. <gam update user uid@domain keyword custom honorific "DDS">

6. Clear ALL the keywords with:

$ gam update user uid@domain keyword clear

$ gam info user uid@domain keywords
  Settings:
  Groups: (15)
<<snip>>

Hope this helps someone else. Maybe incorporate into the wiki?

Thanks!

Jason.

Ross Scroggs wrote:
Jason,

You might consider schemas; you can update individual fields.

Ross

$ gam create schema UserInfo field Honorific type string endfield field MI type string endfield
Schema: UserInfo, Created
$ gam info schema UserInfo
Schema: UserInfo
  displayName: UserInfo
  schemaId: wGFmY5wBQLOkioLmc1afag==
  Field: Honorific
    displayName: Honorific
    fieldType: STRING
    readAccessType: ALL_DOMAIN_USERS
    fieldId: Nf_Xn5fKT3yNiLUc47PE0Q==
  Field: MI
    displayName: MI
    fieldType: STRING
    readAccessType: ALL_DOMAIN_USERS
    fieldId: PNwwgKQNRjuH8mL6VqZjKg==
$ gam update user testuser4 UserInfo.Honorific PHD UserInfo.MI X
User: test...@rdschool.org, Updated
$ gam info user testuser4 customschemas UserInfo nogroups nolicenses
  Settings:
  Custom Schemas:
    Schema: UserInfo
      Honorific: PHD
      MI: X
$ gam update user testuser4 UserInfo.MI Y
User: test...@rdschool.org, Updated
$ gam info user testuser4 customschemas UserInfo nogroups nolicenses
  Settings:
  Custom Schemas:
    Schema: UserInfo
      Honorific: PHD
      MI: Y
$ gam update user testuser4 UserInfo.Honorific Wizard
User: test...@rdschool.org, Updated
$ gam info user testuser4 customschemas UserInfo nogroups nolicenses
  Settings:
  Custom Schemas:
    Schema: UserInfo
      Honorific: Wizard
      MI: Y


On Apr 18, 2019, at 7:24 AM, Jason <jfo...@farmobile.com> wrote:

Ah!

I'll give that a try.

Thanks, Ross.

Jason

Ross Scroggs wrote:

For more options, visit https://groups.google.com/d/optout.
--

#FarmerPower

farmobile.com Jason Forst   |   Farmobile
Director of Infrastructure
Direct: 913-766-4625
Office: 844-337-2255 x 725
Mobile: 913-481-7325

This email is strictly confidential. If you received this email in error please delete it immediately and notify the sender.

Ross Scroggs

unread,
Apr 18, 2019, 1:29:17 PM4/18/19
to google-ap...@googlegroups.com
Jason,

Comments about 4 and 5.
For the following items: emails, externals, ims, keywords, phones, relations, websites; Gam ignores the entry if the value is null.
This is helpful when processing items from a CSV file; blank entries are ignored.
In 4 where all entries were null, all were ignored, so nothing changed as nothing was passed to the API.
In 5, where some, but not all, entries were null, the null entries were ignored, the non-null values were passed to the API resulting in the null values being deleted.

Ross
Reply all
Reply to author
Forward
0 new messages