Thanks Julian, I'm sure that this code will work, but that's not where my
issue lay. I was (and remain) confused about the
"Google.GData.Contacts.GroupMembershipInfo" class. This doesn't exist - at
least, not in the .NET client.
The method I am using to ensure that a contact is in the "My Contacts"
system group is as follows:
Firstly find the ID of the "My Contacts" group by looking through all the
groups until you find a System Group called "Contacts".
GroupsQuery MyGroupQuery = new
GroupsQuery(GroupsQuery.CreateGroupsUri("default"));
GroupsFeed MyGroupFeed = GContactService.Query(MyGroupQuery);
string MyContactGroupID = "";
foreach (GroupEntry ge in MyGroupFeed.Entries)
{
if (ge.SystemGroup == "Contacts")
MyContactGroupID = ge.Id.AbsoluteUri;
}
Then create a GroupMembership with its HRef as the Absolute URI of the "My
Contacts" group. Finally add this GroupMembership to your contact.
GroupMembership gm = new GroupMembership();
gm.HRef = MyContactGroupID;
entry.GroupMembership.Add(gm);
The contact entry is now in the "My Contacts" group.
It all looks a little crude to me - but it works.
So, unless I've done something stupid here, my problem has been sorted.
Thanks for your help on this Julian.
R.
On Wed, Apr 15, 2009 at 5:02 PM, Julian (Google) <[email protected]> wrote:
>
> Hi Richard,
>
> Can you try to create a new Visual Studio project (for example C#
> Console Application), add references->.NET and add:
> Google Data API Core Library
> Google Data API Contacts Library
> Google Data API Extensions Library
>
> Then, the following code should compile:
>
> using System;
> using System.Collections.Generic;
> using System.Text;
>
> using Google.Contacts;
> using Google.GData.Client;
>
> namespace ContactsV2Test
> {
> class Program
> {
> static void Main(string[] args)
> {
> Google.GData.Contacts.GroupMembership group = new
> Google.GData.Contacts.GroupMembership();
>
> }
> }
>
> --Julian
>
> On Apr 15, 10:45 am, Richard Trinder
> <[email protected]> wrote:
> > Thanks for earlier comments but I'm still trying to add contacts to the
> My
> > Contacts System Group (using c#). I'm told I need to
> > us Google.GData.Contacts.GroupMembershipInfo to set the contact group
> > (sounds entirely reasonable) and I need to use V2 of the contacts API
> (also,
> > sounds reasonable). So, I've downloaded the latest version of the dll
> > (Revision 894 from /trunk/clients/cs/lib) but still no success
> > - Google.GData.Contacts.GroupMembershipInfo simply is not an accessible
> > class which is unreasonable!). Any help putting me out of misery would be
> > much appreciated.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---