How to add a contact without a name in GAS?

被刻印的时光 ゝ 提交于 2019-12-25 01:09:32

问题


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?


回答1:


Just use null

contact= ContactsApp.createContact(null,null,"email@somewhere.com");


来源:https://stackoverflow.com/questions/20600852/how-to-add-a-contact-without-a-name-in-gas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!