更新或刪除共用聯絡人的程序類似。
更新共用聯絡人
更新項目時,您必須保留從伺服器擷取項目時出現的「所有」 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>
更改下列內容:
DOMAIN
:網域的網址,例如 example.com。TITLE_NAME
:聯絡資訊項目的名稱,例如 example.com 聯絡資訊清單。FIRST_NAME
:共用聯絡人的名字,例如 Alex。LAST_NAME
:共用聯絡人的姓氏,例如 Kim。PROJECTION
:指定gd:extendedProperty
元素的投影值。如需支援的值清單,請參閱投影值。PRIMARY_PHONE_NUMBER
:共用聯絡人的首選電話號碼,例如 (206)555-1212。CUSTOM_PROPERTY
:您要儲存共用聯絡人相關資訊的自訂屬性名稱,例如寵物。CUSTOM_PROPRTY_VALUE
:您要儲存於共用聯絡人中的自訂屬性值,例如倉鼠。以下是更新後的共用聯絡人項目範例,其中已醒目顯示編輯網址:
<entry> <id>https://www.google.com/m8/feeds/contacts/example.com/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'>Fitzgerald</title> <gd:name> <gd:fullName>Fitzgerald</gd:fullName> </gd:name> <content type='text'>Notes</content> <link rel='self' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/example.com/full/8411573' /> <link rel='edit' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/example.com/full/8411573/1204224422303000' /> <gd:phoneNumber rel='http://schemas.google.com/g/2005#other' primary='true'>456-123-2133</gd:phoneNumber> <gd:extendedProperty name="pet" value="hamster" /> <gd:extendedProperty name="cuisine"> <italian /> </gd:extendedProperty> </entry>
刪除共用聯絡人
刪除的共用聯絡人資料最多可能要經過 24 小時才會從電子郵件地址自動完成功能和聯絡人管理工具中消失。如要更新現有聯絡人,請參閱「更新聯絡人」。請勿刪除聯絡人再重新加入,以免聯絡人資料無法更新。
- 如要刪除共用聯絡人,請將
DELETE
要求傳送至聯絡人的編輯網址。這個網址與更新聯絡人時使用的網址相同。
Google 會在刪除聯絡人後的 30 天內保留聯絡人的預留位置。在此期間,您可以使用 showdeleted
查詢參數要求預留位置。