B.No
B.No

Reputation: 95

How to add a contact without a name in GAS?

I have a collection of contact info that I would like to add to Google Contacts via the ContactsApp. Is some cases this info is just an e-mail address without a name.

contact = ContactsApp.createContact("tmp1", "tmp2", "email");

The above doesn't seem to accept "" as an argument. Neither do the following:

contact.setGivenName(".");
contact.setFamilyName(":");
contact.setFullName("*");

I could use " ", but that is not ideal. Is there any way to have the names be "" just like when an e-mail address is saved from a gmail message sent without the name being available?

Upvotes: 0

Views: 134

Answers (1)

jkhouw1
jkhouw1

Reputation: 7350

Just use null

contact= ContactsApp.createContact(null,null,"[email protected]");

Upvotes: 1

Related Questions