I worked with Ross and we found that the email type where Obsolete was listed accepts string values as well as the normal types of work, other, etc. The Obsolete value was added due to an issue with data migration software using temporary addresses and promoting those to primary.
Here are the steps we took to fix the issue:
We obtained all data with:
gam config csv_output_row_filter "'Emails.*.type':regex:Obsolete" redirect csv "contacts.csv" multiprocess csv "users.csv" gam user ~primaryEmail print contacts fields emails
The redirect allowed us to export all data intelligently instead of exporting and working with a CSV for each individual user. We also limited our pull using regex so that only contacts with our unique Obsolete string were included in the list.
I edited contacts.csv:
Searched and replaced:
"primary": "true"
with
"primary": "false"
Because the types set as obsolete are the emails we want as our primary, this ensured that any currently set to primary were set to false.
Searched and replaced:
"Obsolete", "primary": "false"
with
"work", "primary": "true"
Because Obsolete is a unique string and the data was clustered together, we were able to use the above replacement to ensure anything labeled Obsolete was relabeled as work while at the same time setting primary to true.
Finally, we ran:
gam csv contacts.csv quotechar "'" gam user ~User update contacts ~ContactID json ~JSON
This took our newly saved JSON data and rewrote over the corresponding entries in G Suite.