Thomas Kristensen
unread,Oct 22, 2008, 7:44:36 AM10/22/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Contacts API
Greetings everyone!
I am making a program in C# thats supposed to get all contacts and
groups from Google and stuff it (nicely) into a treeview-control. I
am, however, having a bit of a problem that I was hoping someone could
help me with.
What I want to do is this:
1) Get all groups
2) For each group, get all contacts in that group.
I thought it would be fairly straightforward as there is a "Group"
property on the ContactsQuery which, supposedly, would limit the
feedresult to those contacts in that particular group. But I just
can't get it to work :-(
Here are some snippets of my code:
MyContactService = new ContactsService("My Google Control Panel for
Contacts v. 1.0");
MyContactService.setUserCredentials(m_username, m_password);
MyGroupQuery = new
GroupsQuery(GroupsQuery.CreateGroupsUri("default"));
MyGroupQuery.NumberToRetrieve = 100; // A little large
MyGroupFeed = new MyContactService.Query(MyGroupQuery);
foreach (GroupEntry ge in MyGroupFeed.Entries)
{
MyContactQuery = new
ContactsQuery(ContactsQuery.CreateContactsUri("default"));
MyContactQuery.Group = ge.Id.AbsoluteUri;
MyContactFeed = MyContactService.Query(MyContactQuery);
....
....
}
Its a bit mocked up here, but I hope you get the idea anyways. The
thing is, I get no results back even though I know there are contacts
in whatever group I'm currently working on. I've saved the feed XML
from both queries (using MyContactQuery.Group = "") and in the files,
I can see the ID's for both groups and contacts match. I just can't
seem to make the API filter on the query.
Any help on this would be greatly appreciated as I'm going slightly
nuts here... :-P
Regards,
Thomas Kristensen