根据联系人ID检索Google联系人 [英] Retrieve google contact based on contact Id

查看:110
本文介绍了根据联系人ID检索Google联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When I issue a contacts request to get all of a user's contacts I get contacts Id's of the form:

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

在阅读Google联系人api 3.0时,我对应该使用哪个uri删除联系人感到有些困惑. 正在执行:

Reading the google contacts api 3.0 I was a bit confused on what uri should I use to delete a contact. Doing:

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和请求删除联系人的正确方法是什么? 预先感谢.

What's the correct way to get a contact Id and request for a contact deletion? Thanks in advance.

推荐答案

我对此进行了一些研究,发现了2个错误.

I did some research on this and I found 2 errors.

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

1) I got a "Moved permanently because I issued my request in http and I should have done that in https.

2)uri格式严格为:

2) The uri format is strictly :

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

我有一个setting.Pagesize = 50,这导致我的尿液变成了

I had a setting.Pagesize = 50 , which caused my uri to be

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

无效,并返回400错误请求.

which is invalid and returns a 400 bad request.

联系人ID是您从contact.Id结果uri获得的哈希码.检索联系人条目后,删除操作将按照google api联系人v3.0中的说明进行.

The contact Id is the hash code that you get from the contact.Id result uri. After you retrieve the contact entry, the deletion is as documented in the google api contacts v3.0 .

这篇关于根据联系人ID检索Google联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆