How to get the group of the contact using .NET

28 views
Skip to first unread message

Raj

unread,
Jan 8, 2009, 1:22:36 PM1/8/09
to Google Contacts API
Hi,

I'm able to retrieve all my contacts using .NET library.
I have few questions?

1. How to get the group name where the contact is belong i.e "My
contact" or Freinds etc
2. How do I know there are more contacts to be downloaded? If the user
has 200 contacts, then how can I download all the contacts in one
time?

Thanks
Raj

Jesse Mandel

unread,
Jan 8, 2009, 1:30:30 PM1/8/09
to google-co...@googlegroups.com
The system groups (like My Contacts and Friends) are in version 2 of the API which not implemented in the .NET client library yet. Hopefully in a few weeks but in the meantime, setting the service version to 2.0 will make it sort of work. This SHOULD NOT be used in release software until it's officially supported but it's useful for development.

You need to set the NumberToRetrieve property to retrieve more than 200 contacts.

-Jesse
______________________
www.jessemandel.com

Raj

unread,
Jan 8, 2009, 6:07:22 PM1/8/09
to Google Contacts API
Thanks for the reply.

How can I download the version 2.0 for .net?
If it is not available for download, is there any way to modify the
current library to retirve the contact information?

what is the max limit for "NumberToRetrieve" property?


Thanks
Raj

On Jan 8, 11:30 am, "Jesse Mandel" <jesse.man...@gmail.com> wrote:
> The system groups (like My Contacts and Friends) are in version 2 of the API
> which not implemented in the .NET client library yet. Hopefully in a few
> weeks but in the meantime, setting the service version to 2.0 will make it
> sort of work. This SHOULD NOT be used in release software until it's
> officially supported but it's useful for development.
> You need to set the NumberToRetrieve property to retrieve more than 200
> contacts.
>
> -Jesse
> ______________________www.jessemandel.com
>

Jesse Mandel

unread,
Jan 8, 2009, 6:28:38 PM1/8/09
to google-co...@googlegroups.com
There isn't a separate download but you can force version 2.0 by setting it in the Service:

Service s = new Service("appname");
s.ProtocolMajor = 2;
s.ProtocolMinor = 0;

Then just select the groups as normal and you should see the system groups. REMEMBER this is NOT supported so you should only use this in development until it's supported.

I am not sure what the max limit on NumberToRetrieve is but I use 1000 and it works fine. That should cover most people.

______________________
www.jessemandel.com

Raj

unread,
Jan 8, 2009, 7:22:42 PM1/8/09
to Google Contacts API
Thanks for the information.
It is very useful.

On Jan 8, 4:28 pm, "Jesse Mandel" <jesse.man...@gmail.com> wrote:
> There isn't a separate download but you can force version 2.0 by setting it
> in the Service:
>
> Service s = new Service("appname");
> s.ProtocolMajor = 2;
> s.ProtocolMinor = 0;
>
> Then just select the groups as normal and you should see the system groups.
> REMEMBER this is NOT supported so you should only use this in development
> until it's supported.
>
> I am not sure what the max limit on NumberToRetrieve is but I use 1000 and
> it works fine. That should cover most people.
>
> ______________________www.jessemandel.com

Raj

unread,
Jan 8, 2009, 11:28:58 PM1/8/09
to Google Contacts API
Hi,

I just tried for to get the groups/category and value is empty.
I used the following code.

foreach(GroupMembership membership in contact.GroupMembership)
{
if ( !String.IsNullOrEmpty(category) && !
String.IsNullOrEmpty(membership.Value))
category += ",";
category += membership.Value;
}

Is it right way to get the groups/category for a contact?

I set the ProtocolMajor = 2;
Raj

On Jan 8, 4:28 pm, "Jesse Mandel" <jesse.man...@gmail.com> wrote:
> There isn't a separate download but you can force version 2.0 by setting it
> in the Service:
>
> Service s = new Service("appname");
> s.ProtocolMajor = 2;
> s.ProtocolMinor = 0;
>
> Then just select the groups as normal and you should see the system groups.
> REMEMBER this is NOT supported so you should only use this in development
> until it's supported.
>
> I am not sure what the max limit on NumberToRetrieve is but I use 1000 and
> it works fine. That should cover most people.
>
> ______________________www.jessemandel.com

Jesse Mandel

unread,
Jan 10, 2009, 6:13:34 PM1/10/09
to google-co...@googlegroups.com
GroupMembership is just a placeholder. GroupMembership.HRef is the Group Id, you need to use that to get the GroupEntry.

______________________
www.jessemandel.com

Raj

unread,
Jan 10, 2009, 9:41:48 PM1/10/09
to Google Contacts API
How can I retreive the GroupEntry based on Group ID?
An example would be appreciated.

Thanks
Raj

On Jan 10, 4:13 pm, "Jesse Mandel" <jesse.man...@gmail.com> wrote:
> GroupMembership is just a placeholder. GroupMembership.HRef is the Group Id,
> you need to use that to get the GroupEntry.
>
> ______________________www.jessemandel.com

Jesse Mandel

unread,
Jan 12, 2009, 3:38:15 AM1/12/09
to google-co...@googlegroups.com
Aren't you using the GroupsQuery already? The Id is the queryUri to use. Just pass that and you'll get the GroupsFeed with the group.

-Jesse
______________________
www.jessemandel.com
Reply all
Reply to author
Forward
0 new messages