已废弃的方法
已废弃的方法
addAddress(label, address)
addAddress(label, address)
已弃用。此函数已弃用,不应在新脚本中使用。
使用标准标签或自定义标签为联系人添加地址。
标签可以来自 ContactsApp.Field,也可以来自自定义标签字符串。
// The code below retrieves a contact named "John Doe" and adds the address // "123 Main St, Some City, NY 10011" with the the ContactsApp.Field.WORK_ADDRESS label. var contacts = ContactsApp.getContactsByName('John Doe'); var address = contacts[0].addAddress(ContactsApp.Field.WORK_ADDRESS, '123 Main St, Some City, NY 10011');
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 新地址的标签,来自 ContactsApp.Field 或自定义字符串 |
address | String | 新地址 |
弃踢回攻
- 新创建的字段AddressField
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
addCompany(company, title)
addCompany(company, title)
已弃用。此函数已弃用,不应在新脚本中使用。
为联系人添加公司。
// The code below retrieves a contact named "John Doe" and adds the company "Google" and the // job title "Product Manager". var contacts = ContactsApp.getContactsByName('John Doe'); var url = contacts[0].addCompany('Google', 'Product Manager');
参数
名称 | 类型 | 说明 |
---|---|---|
company | String | 要添加到此联系人的公司的名称 |
title | String | 与该联系人相关的该公司的职位 |
弃踢回攻
- 新创建的字段CompanyField
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
addCustomField(label, content)
addCustomField(label, content)
已弃用。此函数已弃用,不应在新脚本中使用。
使用扩展标签或自定义标签向联系人添加自定义字段。
标签可以来自 ContactsApp.ExtendedField,也可以来自自定义标签字符串。
// The code below retrieves a contact named "John Doe" and adds the custom field // ContactsApp.ExtendedField.HOBBY with the value "hiking". // Note that ContactsApp.ExtendedField.HOBBY is not the same as a custom field named 'HOBBY'. var contacts = ContactsApp.getContactsByName('John Doe'); contacts[0].addCustomField(ContactsApp.ExtendedField.HOBBY, 'hiking');
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 新地址的标签(来自 ContactsApp.ExtendedField 或自定义字符串) |
content | Object | 要存储在自定义字段中的值 |
弃踢回攻
- 新创建的字段CustomField
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
addDate(label, month, day, year)
addDate(label, month, day, year)
已弃用。此函数已弃用,不应在新脚本中使用。
使用标准标签或自定义标签向联系人添加日期。
标签可以来自 ContactsApp.Field,也可以来自自定义标签字符串。
// The code below retrieves a contact named "John Doe" and adds a // ContactsApp.ExtendedField.BIRTHDAY with the value "April 19, 1950". var contacts = ContactsApp.getContactsByName('John Doe'); var birthday = contacts[0].addDate(ContactsApp.Field.BIRTHDAY, ContactsApp.Month.APRIL, 19, 1950);
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 新日期的标签,来自 ContactsApp.Field 或自定义字符串 |
month | Month | 当月(来自 ContactApps.Month) |
day | Integer | 这一天 |
year | Integer | 本年 |
弃踢回攻
- 新创建的日期DateField
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
addEmail(label, address)
addEmail(label, address)
已弃用。此函数已弃用,不应在新脚本中使用。
添加带有标准标签(家庭、工作等)或自定义标签的电子邮件地址
// The code below retrieves a contact named "John Doe" and adds the email address // "j.doe@example.com" to the ContactsApp.Field.HOME_EMAIL label. var contacts = ContactsApp.getContactsByName('John Doe'); var emailField = contacts[0].addEmail(ContactsApp.Field.HOME_EMAIL, 'j.doe@example.com');
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 新电子邮件的标签(来自 ContactsApp.Field 或自定义字符串) |
address | String | 新的电子邮件地址 |
弃踢回攻
- 新添加的字段EmailField
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
addIM(label, address)
addIM(label, address)
已弃用。此函数已弃用,不应在新脚本中使用。
使用标准标签或自定义标签为联系人添加即时通讯地址。
标签可以来自 ContactsApp.Field,也可以来自自定义标签字符串。
// The code below retrieves a contact named "John Doe" and adds the IM address "ChatWithJohn" // with the the ContactsApp.Field.AIM label. var contacts = ContactsApp.getContactsByName('John Doe'); var email = contacts[0].addIM(ContactsApp.Field.AIM, 'ChatWithJohn');
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 新即时通讯地址的标签(来自 ContactsApp.Field 或自定义字符串) |
address | String | 新的 IM 地址 |
弃踢回攻
- 新创建的字段IMField
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
addPhone(label, number)
addPhone(label, number)
已弃用。此函数已弃用,不应在新脚本中使用。
使用标准标签或自定义标签为联系人添加电话号码。
标签可以来自 ContactsApp.Field,也可以来自自定义标签字符串。
// The code below retrieves a contact named "John Doe" and adds the phone number // "212-555-1234" with the the ContactsApp.Field.WORK_PHONE label. var contacts = ContactsApp.getContactsByName('John Doe'); var phone = contacts[0].addPhone(ContactsApp.Field.WORK_PHONE, '212-555-1234');
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 新电话号码的标签(来自 ContactsApp.Field 或自定义字符串) |
number | String | 新电话号码 |
弃踢回攻
- 新创建的字段PhoneField
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
addToGroup(group)
addToGroup(group)
已弃用。此函数已弃用,不应在新脚本中使用。
将该联系人添加到指定的联系人群组。
// The code below creates a new contact and then adds it to the contact group named // "Work Friends" var contact = ContactsApp.createContact('John', 'Doe', 'john.doe@example.com'); var group = ContactsApp.getContactGroup('Work Friends'); contact = contact.addToGroup(group);
参数
名称 | 类型 | 说明 |
---|---|---|
group |
| 要添加此联系人的联系人群组 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
addUrl(label, url)
addUrl(label, url)
已弃用。此函数已弃用,不应在新脚本中使用。
使用标准标签或自定义标签为该联系人添加网址。
标签可以来自 ContactsApp.Field,也可以来自自定义标签字符串。
// The code below retrieves a contact named "John Doe" and adds the URL // "http://www.example.com" with the the ContactsApp.Field.WORK_WEBSITE label. var contacts = ContactsApp.getContactsByName('John Doe'); var url = contacts[0].addUrl(ContactsApp.Field.WORK_WEBSITE, 'http://www.example.com');
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 新地址的标签,来自 ContactsApp.Field 或自定义字符串 |
url | String | 新网址 |
弃踢回攻
- 新创建的字段UrlField
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
deleteContact()
deleteContact()
已弃用。此函数已弃用,不应在新脚本中使用。
删除此联系人。
var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { contacts[i].deleteContact(); }
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getAddresses()
getAddresses()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的所有地址。
// The code below logs the addresses of all the contacts whose names contain "John Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { Logger.log(contacts[i].getAddresses()); }
弃踢回攻
- 地址列表AddressField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getAddresses(label)
getAddresses(label)
已弃用。此函数已弃用,不应在新脚本中使用。
获取与特定字段匹配此联系人的所有地址。
标签可以来自 ContactsApp.Field,也可以来自自定义标签字符串。
// The code below retrieves a contact named "John Doe" and logs the addresses // associated with that contact that are in the ContactsApp.Field.WORK_ADDRESS label. var contacts = ContactsApp.getContactsByName('John Doe'); var addresses = contacts[0].getAddresses(ContactsApp.Field.WORK_ADDRESS); for (var i in addresses) { Logger.log(addresses[i].getAddress()); }
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 要匹配的标签(来自 ContactsApp.Field 或自定义字符串) |
弃踢回攻
- 地址列表AddressField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getCompanies()
getCompanies()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的所有公司。
// The code below logs the company names of all the contacts whose names contain "John Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { var companies = contacts[i].getCompanies(); for (var j in companies) { Logger.log(companies[j].getCompanyName()); } }
弃踢回攻
- 公司列表CompanyField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getContactGroups()
getContactGroups()
已弃用。此函数已弃用,不应在新脚本中使用。
获取包含此联系人的所有联系人组。
// The code below gets a contact named "John Doe" and retrieves all the contact groups that // the contact belongs to var contacts = ContactsApp.getContactsByName('John Doe'); var groups = contacts[0].getContactGroups();
弃踢回攻
- 包含此联系人的群组ContactGroup[]
另请参阅
getCustomFields()
getCustomFields()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的所有自定义字段。
// The code below retrieves a contact named "John Doe" and logs the custom fields // associated with that contact var contacts = ContactsApp.getContactsByName('John Doe'); var fields = contacts[0].getCustomFields(); for (var i in fields) { Logger.log(fields[i].getValue()); }
弃踢回攻
- 自定义字段列表CustomField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getCustomFields(label)
getCustomFields(label)
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人与特定字段匹配的所有自定义字段。
该标签可以是来自 ContactsApp.ExtendedField 的标准标签,也可以是自定义标签字符串。
// The code below retrieves a contact named "John Doe" and logs the custom fields // associated with that contact that are in the ContactsApp.ExtendedField.HOBBY label. var contacts = ContactsApp.getContactsByName('John Doe'); var hobbies = contacts[0].getCustomFields(ContactsApp.ExtendedField.HOBBY); for (var i in hobbies) { Logger.log(hobbies[i].getValue()); }
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 要匹配的标签(来自 ContactsApp.ExtendedField 或自定义字符串) |
弃踢回攻
- 自定义字段列表CustomField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getDates()
getDates()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的所有日期。
// The code below retrieves a contact named "John Doe" and logs the label of the date // associated with that contact var contacts = ContactsApp.getContactsByName('John Doe'); var dates = contacts[0].getDates(); for (var i in dates) { Logger.log(dates[i].getLabel()); }
弃踢回攻
- 日期列表DateField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getDates(label)
getDates(label)
已弃用。此函数已弃用,不应在新脚本中使用。
获取与特定字段匹配的联系人的所有日期。
该标签可以是来自 ContactsApp.Field 的标准标签,也可以是自定义标签字符串。
// The code below retrieves a contact named "John Doe" and logs the day of the month // associated with that contact that are in the ContactsApp.Field.BIRTHDAY label. var contacts = ContactsApp.getContactsByName('John Doe'); var birthdays = contacts[0].getDates(ContactsApp.Field.BIRTHDAY); for (var i in birthdays) { Logger.log(birthdays[i].getDay()); }
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 要匹配的标签(来自 ContactsApp.Field 或自定义字符串) |
弃踢回攻
- 日期列表DateField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getEmailAddresses()
getEmailAddresses()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人可用电子邮件地址的列表。
弃踢回攻
String[]
- 可用于此联系人的电子邮件地址列表
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getEmails()
getEmails()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的电子邮件地址。
// The code below retrieves a contact named "John Doe" and logs the email addresses // associated with that contact var contacts = ContactsApp.getContactsByName('John Doe'); var emails = contacts[0].getEmails(); for (var i in emails) { Logger.log(emails[i].getAddress()); }
弃踢回攻
- 联系人的电子邮件地址列表EmailField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getEmails(label)
getEmails(label)
已弃用。此函数已弃用,不应在新脚本中使用。
获取与特定字段匹配的此联系人的电子邮件地址。
该标签可以是来自 ContactsApp.Field 的标准标签,也可以是自定义标签字符串。
// The code below retrieves a contact named "John Doe" and logs the email addresses // associated with that contact that are in the ContactsApp.Field.HOME_EMAIL label. var contacts = ContactsApp.getContactsByName('John Doe'); var emails = contacts[0].getEmails(ContactsApp.Field.HOME_EMAIL); for (var i in emails) { Logger.log(emails[i].getAddress()); }
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 要匹配的标签(来自 ContactsApp.Field 或自定义字符串) |
弃踢回攻
- 联系人的电子邮件地址列表EmailField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getFamilyName()
getFamilyName()
已弃用。此函数已弃用,不应在新脚本中使用。
获取字符串形式的联系人姓氏(姓氏)。
// The code below logs the family name of all the contacts whose names contain "John" var contacts = ContactsApp.getContactsByName('John'); for (var i in contacts) { Logger.log(contacts[i].getFamilyName()); }
弃踢回攻
String
- 联系人的姓氏
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getFullName()
getFullName()
已弃用。此函数已弃用,不应在新脚本中使用。
以字符串形式获取联系人的全名(给定名字和姓氏)。
// The code below logs the full name of all the contacts whose names contain "John" var contacts = ContactsApp.getContactsByName('John'); for (var i in contacts) { Logger.log(contacts[i].getFullName()); }
弃踢回攻
String
- 联系人的全名
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getGivenName()
getGivenName()
已弃用。此函数已弃用,不应在新脚本中使用。
获取字符串形式的联系人的给定姓名(名字)。
// The code below logs the given name of all the contacts whose names contain "Smith" var contacts = ContactsApp.getContactsByName('Smith'); for (var i in contacts) { Logger.log(contacts[i].getGivenName()); }
弃踢回攻
String
- 联系人的给定名称
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getHomeAddress()
getHomeAddress()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的住址;如果不存在,则获取空字符串。
弃踢回攻
String
- 此联系人的住址,如果不存在,则为空字符串
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getHomeFax()
getHomeFax()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的家庭传真号码;如果不存在,则获取空字符串。
弃踢回攻
String
- 此联系人的家庭传真号码,如果不存在,则为空字符串
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getHomePhone()
getHomePhone()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的家庭电话号码;如果不存在,则获取空字符串。
弃踢回攻
String
- 此联系人的家庭电话号码;如果不存在,则为空字符串
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getIMs()
getIMs()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的所有即时消息地址。
// The code below logs the IM addresses of all the contacts whose names contain "John Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { Logger.log(contacts[i].getIMs()); }
弃踢回攻
- IM 地址列表IMField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getIMs(label)
getIMs(label)
已弃用。此函数已弃用,不应在新脚本中使用。
获取与特定字段匹配的联系人的所有即时通讯地址。
标签可以来自 ContactsApp.Field,也可以来自自定义标签字符串。
// The code below retrieves a contact named "John Doe" and logs the IM addresses // associated with that contact that are in the ContactsApp.Field.GOOGLE_TALK label. var contacts = ContactsApp.getContactsByName('John Doe'); var imAddresses = contacts[0].getIMs(ContactsApp.Field.GOOGLE_TALK); for (var i in imAddresses) { Logger.log(imAddresses[i].getAddress()); }
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 要匹配的标签(来自 ContactsApp.Field 或自定义字符串) |
弃踢回攻
- IM 地址列表IMField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getId()
getId()
已弃用。此函数已弃用,不应在新脚本中使用。
返回该联系人的唯一 ID。
var contact = ContactsApp.createContact('John', 'Doe', 'john.doe@example.com'); var id = contact.getId();
弃踢回攻
String
- 此联系人的 ID
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getInitials()
getInitials()
已弃用。此函数已弃用,不应在新脚本中使用。
获取联系人的首字母。
// The code below logs the initials of all the contacts whose names contain "John Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { Logger.log(contacts[i].getInitials()); }
弃踢回攻
String
- 联系人的首字母
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getLastUpdated()
getLastUpdated()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的上次更新时间。
// The code below logs the last updated date of all the contacts whose names contain // "John Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { Logger.log(contacts[i].getLastUpdated()); }
弃踢回攻
Date
- 此联系人的上次更新日期
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getMaidenName()
getMaidenName()
已弃用。此函数已弃用,不应在新脚本中使用。
获取字符串形式的联系人曾用名。
// The code below logs the maiden name of all the contacts whose names contain "Jane" var contacts = ContactsApp.getContactsByName('Jane'); for (var i in contacts) { Logger.log(contacts[i].getMaidenName()); }
弃踢回攻
String
- 联系人的婚前姓氏
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getMiddleName()
getMiddleName()
已弃用。此函数已弃用,不应在新脚本中使用。
获取字符串形式的联系人中间名。
// The code below logs the middle name of all the contacts whose names contain "Smith" var contacts = ContactsApp.getContactsByName('Smith'); for (var i in contacts) { Logger.log(contacts[i].getMiddleName()); }
弃踢回攻
String
- 联系人的中间名
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getMobilePhone()
getMobilePhone()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的手机号码;如果不存在,则获取空字符串。
弃踢回攻
String
- 此联系人的手机号码,或空字符串(如果不存在)
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getNickname()
getNickname()
已弃用。此函数已弃用,不应在新脚本中使用。
获取字符串形式的联系人昵称。
// The code below logs the nickname of all the contacts whose names contain "John Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { Logger.log(contacts[i].getNickname()); }
弃踢回攻
String
- 联系人的昵称
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getNotes()
getNotes()
已弃用。此函数已弃用,不应在新脚本中使用。
获取与此联系人关联的备注,如果没有备注,则返回空字符串。
// The code below logs the notes of all the contacts whose names contain "John Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { Logger.log(contacts[i].getNotes()); }
弃踢回攻
String
- 与此联系人关联的备注
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getPager()
getPager()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的寻呼机电话号码;如果不存在,则获取空字符串。
弃踢回攻
String
- 此联系人的寻呼机电话号码;如果不存在,则为空字符串
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getPhones()
getPhones()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的所有电话号码。
// The code below logs the phone numbers of all the contacts whose names contain "John Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { Logger.log(contacts[i].getPhones()); }
弃踢回攻
- 电话号码列表PhoneField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getPhones(label)
getPhones(label)
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人与特定字段匹配的所有电话号码。
标签可以来自 ContactsApp.Field,也可以来自自定义标签字符串。
// The code below retrieves a contact named "John Doe" and logs the phone numbers // associated with that contact that are in the ContactsApp.Field.WORK_PHONE label. var contacts = ContactsApp.getContactsByName('John Doe'); var phones = contacts[0].getPhones(ContactsApp.Field.WORK_PHONE); for (var i in phones) { Logger.log(phones[i].getPhoneNumber()); }
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 要匹配的标签(来自 ContactsApp.Field 或自定义字符串) |
弃踢回攻
- 电话号码列表PhoneField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getPrefix()
getPrefix()
已弃用。此函数已弃用,不应在新脚本中使用。
获取联系人姓名的前缀。
// The code below logs the prefix of all the contacts whose names contain "John Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { Logger.log(contacts[i].getPrefix()); }
弃踢回攻
String
- 联系人姓名的前缀
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getPrimaryEmail()
getPrimaryEmail()
已弃用。此函数已弃用,不应在新脚本中使用。
获取字符串形式的联系人主电子邮件地址。
// The code below logs the primary email address of all the contacts whose names contain // "John Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { Logger.log(contacts[i].getPrimaryEmail()); }
弃踢回攻
String
- 联系人的主电子邮件地址
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getShortName()
getShortName()
已弃用。此函数已弃用,不应在新脚本中使用。
获取字符串形式的联系人简称。
// The code below logs the short name of all the contacts whose names contain "Johnathan" var contacts = ContactsApp.getContactsByName('Johnathan'); for (var i in contacts) { Logger.log(contacts[i].getShortName()); }
弃踢回攻
String
- 联系人的简称
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getSuffix()
getSuffix()
已弃用。此函数已弃用,不应在新脚本中使用。
获取联系人姓名的后缀。
// The code below logs the suffix of all the contacts whose names contain "John Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { Logger.log(contacts[i].getSuffix()); }
弃踢回攻
String
- 联系人名字的后缀
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getUrls()
getUrls()
已弃用。此函数已弃用,不应在新脚本中使用。
获取该联系人的所有网址。
// The code below logs the URLs of all the contacts whose names contain "John Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { Logger.log(contacts[i].getUrls()); }
弃踢回攻
- 网址列表UrlField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getUrls(label)
getUrls(label)
已弃用。此函数已弃用,不应在新脚本中使用。
获取与特定字段匹配的联系人的所有网址。
标签可以来自 ContactsApp.Field,也可以来自自定义标签字符串。
// The code below retrieves a contact named "John Doe" and logs the URLs // associated with that contact that are in the ContactsApp.Field.WORK_WEBSITE label. var contacts = ContactsApp.getContactsByName('John Doe'); var urls = contacts[0].getUrls(ContactsApp.Field.WORK_WEBSITE); for (var i in urls) { Logger.log(urls[i].getAddress()); }
参数
名称 | 类型 | 说明 |
---|---|---|
label | Object | 要匹配的标签(来自 ContactsApp.Field 或自定义字符串) |
弃踢回攻
- 网址列表UrlField[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
getUserDefinedField(key)
getUserDefinedField(key)
已弃用。此函数已弃用,不应在新脚本中使用。
获取与指定键关联的用户定义的值。
参数
名称 | 类型 | 说明 |
---|---|---|
key | String | 键可以是任何基本类型(String、int 等), |
弃踢回攻
String
- 使用此键存储的用户定义的内容
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getUserDefinedFields()
getUserDefinedFields()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的所有用户定义的字段,并将其作为 JavaScript 对象的属性返回。
弃踢回攻
Object
- 用户为此联系人定义的字段,作为 JavaScript 对象的属性
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getWorkAddress()
getWorkAddress()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的工作地址;如果不存在任何字符串,则获取空字符串。
弃踢回攻
String
- 此联系人的工作地址,如果不存在,则为空字符串
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getWorkFax()
getWorkFax()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的工作传真号码;如果不存在,则获取空字符串。
弃踢回攻
String
- 此联系人的工作传真号码,如果不存在,则为空字符串
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
getWorkPhone()
getWorkPhone()
已弃用。此函数已弃用,不应在新脚本中使用。
获取此联系人的工作电话号码;如果不存在,则获取空字符串。
弃踢回攻
String
- 此联系人的工作电话号码,或空字符串(如果不存在)
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
removeFromGroup(group)
removeFromGroup(group)
已弃用。此函数已弃用,不应在新脚本中使用。
从指定联系人群组中移除此联系人。
// The code below gets all the contacts named "John Doe" and then removes each of them from // the "Work Friends" contact group var contacts = ContactsApp.getContactsByName('John Doe'); var group = ContactsApp.getContactGroup('Work Friends'); for (var i in contacts) { contacts[i] = contacts[i].removeFromGroup(group); }
参数
名称 | 类型 | 说明 |
---|---|---|
group |
| 要从中移除此联系人的联系人群组 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
setFamilyName(familyName)
setFamilyName(familyName)
已弃用。此函数已弃用,不应在新脚本中使用。
设置联系人的姓氏(姓氏)。
// The code below changes the family name of all the contacts whose names are "John Doe" // to "Doe-Smith" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { contacts[i].setFamilyName('Doe-Smith'); }
参数
名称 | 类型 | 说明 |
---|---|---|
familyName | String | 联系人的新姓氏 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
setFullName(fullName)
setFullName(fullName)
已弃用。此函数已弃用,不应在新脚本中使用。
设置联系人的全名(给定名字和姓氏)。
// The code below changes the full name of all the contacts whose names are "John Doe" // to "Johnny Doe" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { contacts[i].setFullName('Johnny Doe'); }
参数
名称 | 类型 | 说明 |
---|---|---|
fullName | String | 联系人的新全名 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
setGivenName(givenName)
setGivenName(givenName)
已弃用。此函数已弃用,不应在新脚本中使用。
设置联系人的指定姓名(名字)。
// The code below changes the given name of all the contacts whose names are "John Doe" // to "Johnny" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { contacts[i].setGivenName('Johnny'); }
参数
名称 | 类型 | 说明 |
---|---|---|
givenName | String | 联系人的新名字 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
setHomeAddress(addr)
setHomeAddress(addr)
已弃用。此函数已弃用,不应在新脚本中使用。
设置此联系人的住址。
参数
名称 | 类型 | 说明 |
---|---|---|
addr | String | 要设置的住址 |
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
setHomeFax(phone)
setHomeFax(phone)
已弃用。此函数已弃用,不应在新脚本中使用。
设置此联系人的家庭传真号码。
参数
名称 | 类型 | 说明 |
---|---|---|
phone | String | 要设置的住宅传真号码 |
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
setHomePhone(phone)
setHomePhone(phone)
已弃用。此函数已弃用,不应在新脚本中使用。
设置此联系人的住宅电话号码。
参数
名称 | 类型 | 说明 |
---|---|---|
phone | String | 要设置的住宅电话号码 |
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
setInitials(initials)
setInitials(initials)
已弃用。此函数已弃用,不应在新脚本中使用。
设置联系人的首字母。
// The code below sets the initials of all the contacts whose names are "Johnathan Doe" // to "JD" var contacts = ContactsApp.getContactsByName('Johnathan Doe'); for (var i in contacts) { contacts[i].setInitials('JD'); }
参数
名称 | 类型 | 说明 |
---|---|---|
initials | String | 联系人的新姓名缩写 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
setMaidenName(maidenName)
setMaidenName(maidenName)
已弃用。此函数已弃用,不应在新脚本中使用。
设置联系人的曾用名。
// The code below changes the maiden name of all the contacts whose names are "Jane Doe" // to "Smith" var contacts = ContactsApp.getContactsByName('Jane Doe'); for (var i in contacts) { contacts[i].setMaidenName('Smith'); }
参数
名称 | 类型 | 说明 |
---|---|---|
maidenName | String | 联系人的新婚前姓 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
setMiddleName(middleName)
setMiddleName(middleName)
已弃用。此函数已弃用,不应在新脚本中使用。
设置联系人的中间名。
// The code below changes the middle name of all the contacts whose names are "John Doe" // to "Danger" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { contacts[i].setMiddleName('Danger'); }
参数
名称 | 类型 | 说明 |
---|---|---|
middleName | String | 联系人的新中间名 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
setMobilePhone(phone)
setMobilePhone(phone)
已弃用。此函数已弃用,不应在新脚本中使用。
设置此联系人的手机号码。
参数
名称 | 类型 | 说明 |
---|---|---|
phone | String | 要设置的手机号码 |
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
setNickname(nickname)
setNickname(nickname)
已弃用。此函数已弃用,不应在新脚本中使用。
设置联系人的昵称。
// The code below changes the nickname of all the contacts whose names are "John Doe" // to "JohnnyD" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { contacts[i].setNickname('JohnnyD'); }
参数
名称 | 类型 | 说明 |
---|---|---|
nickname | String | 联系人的新昵称 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
setNotes(notes)
setNotes(notes)
已弃用。此函数已弃用,不应在新脚本中使用。
设置与此联系人关联的备注。
// The code below sets the notes of all the contacts whose names are "John Doe" // to "Met him at the hackathon" var contacts = ContactsApp.getContactsByName('John Doe'); for (var i in contacts) { contacts[i].setNotes('Met him at the hackathon'); }
参数
名称 | 类型 | 说明 |
---|---|---|
notes | String | 要为此联系人存储的备注 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
setPager(phone)
setPager(phone)
已弃用。此函数已弃用,不应在新脚本中使用。
设置此联系人的传呼机号码。
参数
名称 | 类型 | 说明 |
---|---|---|
phone | String | 要设置的寻呼机号码 |
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
setPrefix(prefix)
setPrefix(prefix)
已弃用。此函数已弃用,不应在新脚本中使用。
将前缀设置为联系人的姓名。
// The code below sets the prefix of all the contacts whose names are "Johnathan Doe" // to "Mr" var contacts = ContactsApp.getContactsByName('Johnathan Doe'); for (var i in contacts) { contacts[i].setPrefix('Mr'); }
参数
名称 | 类型 | 说明 |
---|---|---|
prefix | String | 联系人姓名的新前缀 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
setPrimaryEmail(primaryEmail)
setPrimaryEmail(primaryEmail)
已弃用。此函数已弃用,不应在新脚本中使用。
设置此联系人的主电子邮件地址。
参数
名称 | 类型 | 说明 |
---|---|---|
primaryEmail | String | 要设置的主电子邮件地址 |
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
setShortName(shortName)
setShortName(shortName)
已弃用。此函数已弃用,不应在新脚本中使用。
设置联系人的简称。
// The code below changes the short name of all the contacts whose names are "Johnathan Doe" // to "John" var contacts = ContactsApp.getContactsByName('Johnathan Doe'); for (var i in contacts) { contacts[i].setShortName('John'); }
参数
名称 | 类型 | 说明 |
---|---|---|
shortName | String | 联系人的新简称 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
setSuffix(suffix)
setSuffix(suffix)
已弃用。此函数已弃用,不应在新脚本中使用。
将后缀设置为联系人的姓名。
// The code below sets the suffix of all the contacts whose names are "Johnathan Doe" // to "Jr" var contacts = ContactsApp.getContactsByName('Johnathan Doe'); for (var i in contacts) { contacts[i].setSuffix('Jr'); }
参数
名称 | 类型 | 说明 |
---|---|---|
suffix | String | 该联系人的名字的新后缀 |
弃踢回攻
- 此联系人Contact
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
另请参阅
setUserDefinedField(key, value)
setUserDefinedField(key, value)
已弃用。此函数已弃用,不应在新脚本中使用。
为此联系人设置单个用户定义的字段,该字段将通过给定的键进行存储。
参数
名称 | 类型 | 说明 |
---|---|---|
key | String | 键可以是任何基本类型(String、int 等), |
value | String | 该值可以是任何基本类型(String、int 等)。 |
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
setUserDefinedFields(o)
setUserDefinedFields(o)
已弃用。此函数已弃用,不应在新脚本中使用。
使用指定对象的属性为此联系人设置用户定义的字段。
参数
名称 | 类型 | 说明 |
---|---|---|
o | Object | 具有一个或多个属性的对象,其形式为 {key: value} |
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
setWorkAddress(addr)
setWorkAddress(addr)
已弃用。此函数已弃用,不应在新脚本中使用。
设置此联系人的工作地址。
参数
名称 | 类型 | 说明 |
---|---|---|
addr | String | 要设置的工作地址 |
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
setWorkFax(phone)
setWorkFax(phone)
已弃用。此函数已弃用,不应在新脚本中使用。
设置此联系人的工作传真号码。
参数
名称 | 类型 | 说明 |
---|---|---|
phone | String | 要设置的工作传真号码 |
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds
setWorkPhone(phone)
setWorkPhone(phone)
已弃用。此函数已弃用,不应在新脚本中使用。
设置此联系人的工作电话号码。
参数
名称 | 类型 | 说明 |
---|---|---|
phone | String | 要设置的工作电话号码 |
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://www.google.com/m8/feeds