如何在GAS中添加没有姓名的联系人? [英] How to add a contact without a name in GAS?

查看:116
本文介绍了如何在GAS中添加没有姓名的联系人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些联系人信息,我希望通过ContactsApp将其添加到Google通讯录中.在某些情况下,此信息只是一个没有名称的电子邮件地址.

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("*");

我可以使用",但这并不理想.有什么办法可以使名称为",就像在没有可用名称的情况下从发送的gmail邮件中保存电子邮件地址一样?

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?

推荐答案

只需使用null

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

这篇关于如何在GAS中添加没有姓名的联系人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆