使用 Google Contacts API v3,如何获取特定组的联系人?
Using Google Contacts API v3, how to get contacts for a specific group?
我可以获取联系人和群组。我无法做的是查询特定组的联系人。我已经阅读了文档,并且指定组 Atom Id 没有意义,因为存在类型冲突。
const string name = "MyGroup";
var uri = ContactsQuery.CreateGroupsUri("default");
var gQuery = new GroupsQuery(uri);
var group = cr.Get<Group>(gQuery).Entries.AsQueryable()
.SingleOrDefault(e => e.GroupEntry.Title.Text.Contains(name));
uri = ContactsQuery.CreateContactsUri("default");
var cQuery = new ContactsQuery(uri);
if (group != null)
{
cQuery.Group = (string)group.AtomEntry.Id; // WHAT TO PUT HERE ?
}
Feed<Contact> feed = cr.Get<Contact>(cQuery);
无法分配类型 AtomId...
group.AtomEntry.Id // type = AtomId
... 为字符串类型...
cQuery.group // type = string
谢谢!
改变...
cQuery.Group = (string)group.AtomEntry.Id;
到...
cQuery.Group = (string)group.Id;
提示来自this post. Where I realized that the URI being constructed is quite long and includes [the contacts URI] + ?group= [the group base/id URI]. Example: https://www.google.com/m8/feeds/contacts/default/full?group=http://www.google.com/m8/feeds/groups/user.email%40domain.com/base/some_alphanumeric_id
我可以获取联系人和群组。我无法做的是查询特定组的联系人。我已经阅读了文档,并且指定组 Atom Id 没有意义,因为存在类型冲突。
const string name = "MyGroup";
var uri = ContactsQuery.CreateGroupsUri("default");
var gQuery = new GroupsQuery(uri);
var group = cr.Get<Group>(gQuery).Entries.AsQueryable()
.SingleOrDefault(e => e.GroupEntry.Title.Text.Contains(name));
uri = ContactsQuery.CreateContactsUri("default");
var cQuery = new ContactsQuery(uri);
if (group != null)
{
cQuery.Group = (string)group.AtomEntry.Id; // WHAT TO PUT HERE ?
}
Feed<Contact> feed = cr.Get<Contact>(cQuery);
无法分配类型 AtomId...
group.AtomEntry.Id // type = AtomId
... 为字符串类型...
cQuery.group // type = string
谢谢!
改变...
cQuery.Group = (string)group.AtomEntry.Id;
到...
cQuery.Group = (string)group.Id;
提示来自this post. Where I realized that the URI being constructed is quite long and includes [the contacts URI] + ?group= [the group base/id URI]. Example: https://www.google.com/m8/feeds/contacts/default/full?group=http://www.google.com/m8/feeds/groups/user.email%40domain.com/base/some_alphanumeric_id