更新或刪除共用聯絡人的程序類似。
更新共用聯絡人
更新項目時,您必須保留從伺服器擷取項目時顯示的「所有」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
查詢參數要求預留位置。