使用人员 API 将联系人添加到群组时出错

Error when including a contact to group using People API

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

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

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

我在任何地方都没有看到这些组被贬值

我试过

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, therefore each method of the service has a corresponding method exposed by the API, specifically 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 method is explicitly forbidden (you have to examine the ContactGroupMembership 资源文档更新 memberships 字段时添加要联系的系统组以查找信息):

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