更新或删除共享联系人
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
更新或删除共享联系人的过程类似。
更新条目时,您必须保留从服务器检索条目时存在的所有 XML。否则,系统会删除被忽略的元素。更新最长可能需要 24 小时才会反映在电子邮件地址自动补全功能和联系人管理器中。
如需更新现有的共享联系人,请执行以下操作:
- 获取要更新的条目。
- 修改条目。
向联系人的修改网址发送 PUT
请求,并在消息正文中添加更新后的条目。使用 application/atom+xml
内容类型,并确保更新后的条目中的 <id>
值与现有条目的 <id>
完全匹配。修改网址以版本号结尾,以便检测来自不同来源的更新冲突。如需了解详情,请参阅版本控制。
更新条目:
<entry>
<id>https://www.google.com/m8/feeds/contacts/DOMAIN/base/8411573</id>
<updated>2008-02-28T18:47:02.303Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/contact/2008#contact' />
<title type='text'>TITLE_NAME</title>
<gd:name>
<gd:fullName>FIRST_NAME LAST_NAME</gd:fullName>
</gd:name>
<content type='text'>NOTES</content>
<link rel='self' type='application/atom+xml'
href='https://www.google.com/m8/feeds/contacts/DOMAIN/PROJECTION/8411573' />
<link rel='edit' type='application/atom+xml'
href='https://www.google.com/m8/feeds/contacts/DOMAIN/PROJECTION/8411573/1204224422303000' />
<gd:phoneNumber rel='http://schemas.google.com/g/2005#other'
primary='true'>PRIMARY_PHONE_NUMBER</gd:phoneNumber>
<gd:extendedProperty name="CUSTOM_PROPERTY" value="CUSTOM_PROPRTY_VALUE" />
</entry>
替换以下内容:
已删除的共享联系人最长可能需要 24 小时才能从电子邮件地址自动补全功能和联系人管理器中消失。如需更新现有联系人,请参阅更新联系人。
请勿通过删除联系人然后重新添加来更新联系人。
- 如需删除共享联系人,请向联系人的修改网址发送
DELETE
请求。此网址与用于更新联系人的网址相同。
删除联系人后,Google 会将其占位符保留 30 天。在此期间,您可以使用 showdeleted
查询参数请求占位符。
后续步骤
更新或删除共享联系人的照片
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-25。
[null,null,["最后更新时间 (UTC):2025-03-25。"],[],[],null,["# Update or delete a shared contact\n\nThe processes to update or delete a shared contact are similar.\n\nUpdate a shared contact\n-----------------------\n\nWhen you update an entry, you must preserve *all* the XML that was present when\nyou retrieved the entry from the server. Otherwise the ignored elements are\ndeleted. Updates can take up to 24 hours to be reflected in the email address\nauto-complete and the contact manager.\n\nTo update an existing shared contact, do the following:\n\n1. [Get the entry that you want to update](/workspace/admin/domain-shared-contacts/get-shared-contacts).\n2. Edit the entry.\n3. Send a `PUT` request with the updated entry in the message body to the\n contact's edit URL. Use the `application/atom+xml` content type and make\n sure that the `\u003cid\u003e` value in the updated entry exactly matches the `\u003cid\u003e`\n of the existing entry. The edit URL ends with a version number, in order to\n detect conflicts of updates from different sources. For more information,\n see\n [versioning](https://developers.google.com/gdata/docs/1.0/reference#Optimistic-concurrency).\n\n Update the entry: \n\n ```xml\n \u003centry\u003e\n \u003cid\u003ehttps://www.google.com/m8/feeds/contacts/DOMAIN/base/8411573\u003c/id\u003e\n \u003cupdated\u003e2008-02-28T18:47:02.303Z\u003c/updated\u003e\n \u003ccategory scheme='http://schemas.google.com/g/2005#kind'\n term='http://schemas.google.com/contact/2008#contact' /\u003e\n \u003ctitle type='text'\u003eTITLE_NAME\u003c/title\u003e\n \u003cgd:name\u003e\n \u003cgd:fullName\u003eFIRST_NAME LAST_NAME\u003c/gd:fullName\u003e\n \u003c/gd:name\u003e\n \u003ccontent type='text'\u003eNOTES\u003c/content\u003e\n \u003clink rel='self' type='application/atom+xml'\n href='https://www.google.com/m8/feeds/contacts/DOMAIN/PROJECTION/8411573' /\u003e\n \u003clink rel='edit' type='application/atom+xml'\n href='https://www.google.com/m8/feeds/contacts/DOMAIN/PROJECTION/8411573/1204224422303000' /\u003e\n \u003cgd:phoneNumber rel='http://schemas.google.com/g/2005#other'\n primary='true'\u003ePRIMARY_PHONE_NUMBER\u003c/gd:phoneNumber\u003e\n \u003cgd:extendedProperty name=\"CUSTOM_PROPERTY\" value=\"CUSTOM_PROPRTY_VALUE\" /\u003e\n \u003c/entry\u003e\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eDOMAIN\u003c/var\u003e: The URL for your domain---for example, example.com.\n - \u003cvar translate=\"no\"\u003eTITLE_NAME\u003c/var\u003e: A name for the contact entry---for example, example.com contact list.\n - \u003cvar translate=\"no\"\u003eFIRST_NAME\u003c/var\u003e: The first name of the shared contact---for example, Alex.\n - \u003cvar translate=\"no\"\u003eLAST_NAME\u003c/var\u003e: The last name of the shared contact---for example, Kim.\n - \u003cvar translate=\"no\"\u003ePROJECTION\u003c/var\u003e: The projection value that specifies the `gd:extendedProperty` elements. For a list of supported values, see [Projection values](/workspace/admin/domain-shared-contacts/extended-properties-projections#projection_values).\n - \u003cvar translate=\"no\"\u003ePRIMARY_PHONE_NUMBER\u003c/var\u003e: The preferred phone number for the shared contact---for example, (206)555-1212.\n - \u003cvar translate=\"no\"\u003eCUSTOM_PROPERTY\u003c/var\u003e: A name for a custom property that you want to store about the shared contact---for example, pet.\n - \u003cvar translate=\"no\"\u003eCUSTOM_PROPRTY_VALUE\u003c/var\u003e: A value for a custom\n property that you want to store about the shared contact---for example,\n hamster.\n\n The following is an example of an updated entry for a shared contact with\n the edit URL highlighted: \n\n ```xml\n \u003centry\u003e\n \u003cid\u003ehttps://www.google.com/m8/feeds/contacts/example.com/base/8411573\u003c/id\u003e\n \u003cupdated\u003e2008-02-28T18:47:02.303Z\u003c/updated\u003e\n \u003ccategory scheme='http://schemas.google.com/g/2005#kind'\n term='http://schemas.google.com/contact/2008#contact' /\u003e\n \u003ctitle type='text'\u003eFitzgerald\u003c/title\u003e\n \u003cgd:name\u003e\n \u003cgd:fullName\u003eFitzgerald\u003c/gd:fullName\u003e\n \u003c/gd:name\u003e\n \u003ccontent type='text'\u003eNotes\u003c/content\u003e\n \u003clink rel='self' type='application/atom+xml'\n href='https://www.google.com/m8/feeds/contacts/example.com/full/8411573' /\u003e\n \u003clink rel='edit' type='application/atom+xml'\n href='https://www.google.com/m8/feeds/contacts/example.com/full/8411573/1204224422303000' /\u003e\n \u003cgd:phoneNumber rel='http://schemas.google.com/g/2005#other'\n primary='true'\u003e456-123-2133\u003c/gd:phoneNumber\u003e\n \u003cgd:extendedProperty name=\"pet\" value=\"hamster\" /\u003e\n \u003cgd:extendedProperty name=\"cuisine\"\u003e\n \u003citalian /\u003e\n \u003c/gd:extendedProperty\u003e\n \u003c/entry\u003e\n ```\n\nDelete shared contacts\n----------------------\n\nDeleted shared contacts can take up to 24 hours to disappear from the email\naddress autocomplete and the contact manager. To update existing contacts, see\n[Updating contacts](#update_a_shared_contact).\nDon't update contacts by deleting contacts and then re-adding them.\n\n- To delete a shared contact, send a `DELETE` request to the contact's edit URL. This is the same URL used to [update contacts](#update_a_shared_contact).\n\nGoogle retains placeholders for deleted contacts for 30 days after deletion.\nDuring that time, you can request the placeholders by using the `showdeleted`\nquery parameter.\n\nNext steps\n----------\n\n[Update or delete a photo for a shared contact](/workspace/admin/domain-shared-contacts/update-delete-photo-shared-contacts)"]]