我能够获得联系人和群组。我无法做的是查询特定组的联系人。我已经阅读了文档,并且指定组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
谢谢!
答案 0 :(得分:0)
更改...
cQuery.Group = (string)group.AtomEntry.Id;
为...
cQuery.Group = (string)group.Id;
提示来自this post。我意识到构造的URI很长并且包括[contacts URI] +?group = [group base / id URI]。示例: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