Wendy, I'm not doing *exactly *what you want, though what I am doing may be a good stepping stone to what you need. I took a different approach, probably influenced by whatever code I found :)
I'm using VB rather than C#, though the code should be easy to translate. Here's my approach. For web-based users: I rely on the Shared Contacts option, then use my code to add Groups manually For Outlook users: I generate a GAL for the users, then inject my groups manually (until a soon-to-be-released version of the GAL Generator enhances the whole thing to include Groups - apparently). To this end I maintain 2 local text files - 1 is a list of users and passwords, the other a list of groups along with text for the Notes to explain who is in each Group. I load the Users file and the Groups file, then I can choose to update one particular user's account using the credentials in the file, or I can select ALL and it just steps through the file and updates each one. The update consists of purging the existing Groups and repopulating their Contacts with the latest list of Groups. It's slow, and prone to timeouts from Google, but I've not found a better of doing this, and got no response here. Like I said. This might not be exactly what you want, but if you're interested in seeing the code I can share. Alex On Thu, Nov 12, 2009 at 1:04 PM, nub4life <[email protected]> wrote: > I'm trying to create a tool that administers all of my domain's users' > contacts. We have Google Apps Premier. > > I'm having some trouble reading all the documentation (it is a little > overwhelming!), so I hope someone here can help me out. > > I have enabled 2-legged OAuth for my apps. I'm trying to write a > Windows Form application in C# that grabs the "master" list of > contacts (basically, the admin profile's contact list, which will be > administered in Google Contacts), figure out who was added/removed, > and update everyone's contact list accordingly. > > I was able to set up the ContactService by doing this: > GOAuthRequestFactory go = new GOAuthRequestFactory("cp", > "ContactsManager"); > go.ConsumerKey = "mydomain.com"; > go.ConsumerSecret = "myconsumersecret"; > > ContactsService cs = new ContactsService("ContactsManager"); > cs.RequestFactory = go; > > Then I did this and was able to retrieve the admin's contact list feed > info: > Uri contactsUri = new OAuthUri("https://www.google.com/m8/feeds/ > contacts/default/full<https://www.google.com/m8/feeds/%0Acontacts/default/full>", > "adminuser", > "mydomain"); > ContactsQuery contactsQuery = new ContactsQuery(); > contactsQuery.UseSSL = true; > contactsQuery.Uri = contactsUri; > contactsQuery.ShowDeleted = true; > > ContactsFeed feed = cs.Query(contactsQuery); > > foreach (ContactEntry entry in feed.Entries) > { > Console.WriteLine(entry.Id.Uri.ToString() + " " + > entry.Deleted); > } > > Now I am stuck. I don't know how to use this information to update > everyone's contact lists. Can anyone shed some light? Here are some of > my problems: > > 1. I don't know how to identify each user (so that I can access their > contact list to update) from the ContactEntry (which seems to be in > relation to the admin user's contact list). Now that I'm thinking > about it, perhaps I need to use Google Provisioning API to do that? > 2. Even if I have a list of all the users, how do I figure out what > the URI (ie: the URI of the added/deleted contact) is to make a change > to the contact list? > 3. I know I can create contacts (http://code.google.com/apis/contacts/ > docs/2.0/developers_guide_dotnet.html#Creating<http://code.google.com/apis/contacts/%0Adocs/2.0/developers_guide_dotnet.html#Creating>), > but that example they > have uses ContactRequest, which in turn uses RequestSettings... which > I don't know how to use with GOAuthRequestFactory (GAuthToken, > QueryAuthToken() are null). > > Thanks in advance, I'd really appreciate any help/input anyone has! > > -- > > 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]. > For more options, visit this group at > http://groups.google.com/group/google-contacts-api?hl=. > > > -- 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]. For more options, visit this group at http://groups.google.com/group/google-contacts-api?hl=.
