gpt4 book ai didi

google-apps-script - 使用 People API 将联系人添加到群组时出错

转载 作者:行者123 更新时间:2023-12-04 00:53:59 26 4
gpt4 key购买 nike

我需要将一个联系人添加到以下所有组。我尝试将联系人一个一个地添加到组中,但是当我对第一组进行测试时,API 出现错误

GoogleJsonResponseException: API call to people.contactGroups.members.modify failed with error: Cannot add contacts to deprecated system contact group resource name "contactGroups/chatBuddies".

我想将创建的联系人添加到所有这些组

  • contactGroups/chatBuddies
  • 联系人组/全部
  • 联系群组/ friend
  • 联系小组/同事
  • 联系人组/家庭
  • 联系人组/已阻止

我在任何地方都看不到这些群体被贬值

我试过

var b = {
"phoneNumbers": [{
"type": "mobile",
"value": "09876543210"
}],
"names": [{
"unstructuredName": "Test account"
}],
"urls": [],
"addresses": [{
"type": "work",
"formattedValue": "0"
}],
"organizations": [{
"name": "Organisation"
}],
"emailAddresses": [{
"type": "home",
"value": "abcd@gmail.com"
}]
}

function doGet(e) {
var resource = People.People.createContact(b);
var id = resource.metadata.sources[0].id;
var contactResourceName = resource["resourceName"];
var group = People.ContactGroups.get("contactGroups/friends");
var groupResourceName = group["resourceName"];
var membersResource = {
"resourceNamesToAdd": [
contactResourceName
]
}
People.ContactGroups.Members.modify(membersResource, groupResourceName);
return ContentService.createTextOutput(JSON.stringify(group));
}

最佳答案

弃用通知在哪里?

它展示在一个锁着的文件柜的底部,该文件柜卡在一个废弃的厕所里,门上有一个标语,上面写着“小心豹子”。

严肃地说,高级服务是包装相应 REST API 的薄层,在本例中为 People API ,因此服务的每个方法都有一个相应的API暴露的方法,具体为contactGroups.members.modify .

该方法的描述如下,清楚地概述了系统联系人组实际上已被弃用:

The only system contact groups that can have members added are contactGroups/myContacts and contactGroups/starred. Other system contact groups are deprecated and can only have contacts removed.


我可以直接通过 API 更新系统组吗?

这似乎是不可能的,因为在通过 people.updateContact 更新 memberships 字段时添加要联系的系统组方法被明确禁止(您必须检查 ContactGroupMembership 资源文档以查找信息):

Any contact group membership can be removed, but only user group or "myContacts" or "starred" system group memberships can be added.

关于google-apps-script - 使用 People API 将联系人添加到群组时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64122354/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com