如何在Google联系人中为“部门”字段添加或设置值?“公司”和“职务”没有问题]
var contact = ContactsApp.createContact('John', 'Doe', '[email protected]');
var company_set = contact.addCompany('Google', 'Product Manager');
// ?????
var department_set = contact.add______________('IT');
UPD:感谢@TheMaster,我设法解决了这个任务。您可以在这里找到不错的API示例https://www.any-api.com/googleapis_com/people/docs/people/people_people_createContact使用此站点上的示例,您可以构建API所需的主体。
var reqBody = {
names: [
{
givenName: givenName,
familyName: familyName
}
],
phoneNumbers: phoneNumbers,
organizations: [
{
title: orgTitle,
department: orgDepartment
}
],
emailAddresses: [
{
value: emailAddres,
type: 'work'
}
],
addresses: [
{
city: city,
streetAddress: streetAddress,
type: 'work'
}
],
memberships: [
{
contactGroupMembership: {
contactGroupId: contactGroupsID,
contactGroupResourceName: "contactGroups/" + contactGroupsID
}
}
]
}
createContact(reqBody);
可以通过department
通过People API设置Advanced Google services。当联系人为created through the api时,人员对象可以包括organizations[].department