Hi,

It is true that the documentation for Contacts in .NET is not in good
shape, but, we are working on getting it up to date.

Here is a sample that should help you get users groups, create new
groups and add a group to users, I hope it helps.

Cheers,
Julian.

Sample:

ContactsService contactsService = new ContactsService("myDemoApps");

// Using ClientLogin username/password authentication
contactsService.setUserCredentials("[email protected]", "Password");

// Uri for Group operations for the user
Uri groupUri = new Uri(GroupsQuery.CreateGroupsUri
("[email protected]"));

// List all Groups for the user
GroupsFeed groupsFeed = contactsService.Query(new GroupsQuery
(groupUri.AbsoluteUri));
foreach (GroupEntry entry in groupsFeed.Entries)
{
 Console.WriteLine( entry.Title.Text + "\r\n " );
 Console.WriteLine( entry.Id.AbsoluteUri + "\r\n ");
}

// Create a new Group
GroupEntry newGroup = new GroupEntry();
newGroup.Title.Text = "New Group Title 3";
newGroup.Summary.Text = "Group's Summary 3";
newGroup = contactsService.Insert(groupUri, newGroup) as GroupEntry;

// New Group's ID
string newGroupID = newGroup.Id.AbsoluteUri;

ContactsQuery query = new ContactsQuery
( ContactsQuery.CreateContactsUri("default"));
ContactsFeed feed = contactsService.Query(query);
foreach (ContactEntry entry in feed.Entries)
{
 // new Group membership element, is use to add the new group to each
user.
 GroupMembership groupMembership = new GroupMembership();
 groupMembership.HRef = newGroupID;
 entry.GroupMembership.Add(groupMembership);
 entry.Update();
}


On Feb 23, 7:57 pm, andreroy55 <[email protected]> wrote:
> I've been going over this for a few days and so far can't find
> anything that addresses what I'm looking for.
>
> I need to update about 2000 users from our current mail system to
> Google Apps.
>
> Step 1. Transfer their contacts. Many of them have grouped their
> contacts, and I need to replicate that.
>
> I want to use OAuth because that way I won't have to log in as each
> individual user to update their contacts.
>
> I'm using C# (.NET) to do this and .. well, I can't find much.
>
> The documentation for the Contacts API for .NET skips the entire
> concept of Contact Groups and it doesn't look like any of it adresses
> OAuth. I've managed to get some stuff working with OAuth, like add
> contacts to a user's "base" or infiled contacts, I can also add
> groups.
>
> I'd love to figure out how to list a user's contact groups and how to
> add contacts to a group. I did find some pseudo code the other
> day  ...   1. get a list of ContactGroups with their IDs  2. add a
> contact to the group. Exactly what I want to do, but I can't find how
> to do it.
>
> I don't find this:http://google-gdata.googlecode.com/svn/docs/index.html#
> very useful, it seems that once I know what I want, it would be great,
> but I don't quite know what I want or need.
>
> I guess, what I really want is some documentation that shows me how to
> use the API, all that I find is what it is.
>
> Sorry to sound all complainy like that, it just gets very frustrating.
> I'll keep looking ....
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to