更新或删除共享联系人的照片
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
更新共享联系人的照片与更新共享联系人的信息略有不同。如需了解如何处理共享联系人的相关信息,请参阅更新或删除共享联系人。使用照片链接时,您必须在 HTTP 标头中指定授权令牌。如需了解详情,请参阅了解身份验证和授权。
每个共享的联系人都有一个照片链接元素。无论联系人是否有关联的照片,系统都会显示照片链接元素。如果联系人确实有照片,则该元素包含一个 gd:etag
属性,用于指定照片的 ETag
HTTP 标头。借助 ETag
,您可以引用特定条目的特定版本。在这种情况下,它可让您引用照片的特定版本。如果联系人没有照片,则没有 gd:etag
属性,而 href
属性提供用于向联系人添加照片的网址。
如需添加或更新照片,请发送新照片:
PUT https://www.google.com/m8/feeds/photos/media/liz%40DOMAIN/PHOTO_LINK
替换以下内容:
DOMAIN
:您的网域的网址,例如 example.com。
PHOTO_LINK
:一个唯一的数字值,表示所分享联系人的照片链接,例如 c9012de。
以下是照片链接元素示例:
<link rel="http://schemas.google.com/contacts/2008/rel#photo"
type="image/*" href="https://www.google.com/m8/feeds/photos/media/liz%40example.com/c9012de">
如需删除照片,您必须使用 HTTP DELETE
方法。
更新或删除照片时,请在 HTTP 请求的 If-Match
标头中发送照片的 ETag
。如果您没有最新版本的照片,请使用 If-Match: *
替换版本控制系统并删除照片。
如需详细了解 ETags
,请参阅 Google Data API 协议参考文档。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-25。
[null,null,["最后更新时间 (UTC):2025-03-25。"],[],[],null,["# Update or delete a photo for a shared contact\n\nUpdating a photo for a shared contact is slightly different than updating a\nshared contact's information. For information about working with a shared\ncontact's information, see\n[Update or delete a shared contact](/workspace/admin/domain-shared-contacts/update-delete-shared-contacts).\nWhen using photo links, you must specify the authorization token in the HTTP\nheader. For more information, see\n[Learn about authentication and authorization](https://developers.google.com/workspace/guides/auth-overview).\n\nUpdate a photo for a shared contact\n-----------------------------------\n\nEvery shared contact has a photo link element. The photo link element appears\nwhether the contact has an associated photo or not. If the contact does have a\nphoto, then the element contains a `gd:etag` attribute that specifies an `ETag`\nHTTP header for the photo. An `ETag` lets you refer to a specific version of a\nparticular entry. In this case, it lets you refer to a specific verion of a\nphoto. If the contact has no photo, then there's no `gd:etag` attribute, and\nthe `href` attribute provides the URL to use to add a\nphoto to the contact.\n\n- To add or update a photo, send a new photo:\n\n ```xml\n PUT https://www.google.com/m8/feeds/photos/media/liz%40DOMAIN/PHOTO_LINK\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\"\u003ePHOTO_LINK\u003c/var\u003e: A unique numerical value that represents the photo link for the shared contact---for example, c9012de.\n\n The following is an example of a photo link element: \n\n ```\n \u003clink rel=\"http://schemas.google.com/contacts/2008/rel#photo\"\n type=\"image/*\" href=\"https://www.google.com/m8/feeds/photos/media/liz%40example.com/c9012de\"\u003e\n ```\n\nDelete a photo for a shared contact\n-----------------------------------\n\nTo delete a photo, you must use the HTTP `DELETE` method.\n\nWhen updating or deleting a photo, send the photo's `ETag` in the `If-Match`\nheader of the HTTP request. If you don't have the latest version of the photo\nuse `If-Match: *` to override the versioning system and delete the photo.\n\nFor more information about `ETags`, see the\n[Google Data APIs protocol reference](https://developers.google.com/gdata/docs/2.0/reference#ResourceVersioning)."]]