【问题标题】:Retrieve google contact based on contact Id根据联系人 ID 检索谷歌联系人
【发布时间】:2014-05-16 13:54:31
【问题描述】:

当我发出联系人请求以获取用户的所有联系人时,我会得到以下表单的联系人 ID:

http://www.google.com/m8/feeds/contacts/sometestaccount%40gmail.com/base/4f822c758a541b6b

阅读 google 联系人 api 3.0 我对删除联系人应该使用什么 uri 感到有些困惑。 正在做:

var cr = new ContactsRequest(settings);
var uri = new Uri("http://www.google.com/m8/feeds/contacts/sometestaccount%40gmail.com/base/4f822c758a541b6b");
var contact = cr.Retrieve<Contact>(uri);
cr.Delete(contact);

失败

Google.GData.Client.GDataRequestException : Execution of request returned unexpected result: http://www.google.com/m8/feeds/contacts/sometestaccount%40gmail.com/base/4f822c758a541b6b?max-results=50MovedPermanently

获取联系人 ID 并请求删除联系人的正确方法是什么? 提前致谢。

【问题讨论】:

    标签: c# google-contacts-api


    【解决方案1】:

    我对此做了一些研究,发现了 2 个错误。

    1) 我收到“永久移动,因为我在 http 中发出了我的请求,我应该在 https 中完成。

    2) uri 格式严格:

    https://www.google.com/m8/feeds/contacts/{userEmail}/full/{contactId}
    

    我有一个 setting.Pagesize = 50 ,这导致我的 uri 是

    https://www.google.com/m8/feeds/contacts/{userEmail}/full/{contactId}?max-results=50
    

    这是无效的并返回 400 错误请求。

    联系人 ID 是您从 contact.Id 结果 uri 中获得的哈希码。检索联系人条目后,删除记录在 google api contacts v3.0 中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-11
      • 1970-01-01
      • 1970-01-01
      • 2012-08-03
      • 2011-10-09
      • 1970-01-01
      相关资源
      最近更新 更多