I am having problems getting contacts back.


The method I wrote (at the end of this email) expects an access token in (this 
access token appears to be valid as it works if pasted as is in the 
OAuthPlayground).


ya29.AHES6ZQL-SM6t-XXXXXXXXXXXXXXXXXXXX_XXXXXXXXXXXXX [Last portions replaced 
by 'X's)

That exact same access token and contacts url via the OAuthPlayGround

(https://code.google.com/oauthplayground/) gets me valid data back.


The authentication requested access to both the tasks and contacts scope.  The 
application can access the tasks information properly, but not the contact one 
(but, as mentioned above, I can get the contacts with that same access token 
via the oAuthPlayGround).


>From my application, I get:

 Google.GData.Client.GDataRequestException: Execution of request failed: https:/

/www.google.com/m8/feeds/contacts/default/full?updated-min=2008-01-01T00:00:00-0

8:00 ---> System.Net.WebException: The remote server returned an error: (401) 
Unauthorized.


Method (from my project) failing:

        private static void GetContacts(string token)
        {
            var service = new ContactsService("API Project");
            RequestSettings settings = new RequestSettings("API Project", 
token);
 
            ContactsRequest cr = new ContactsRequest(settings);
            cr.Service.SetAuthenticationToken(token);
            Feed<Contact> feed2 = cr.GetContacts();
            ContactsQuery query = new 
ContactsQuery(ContactsQuery.CreateContactsUri("default"));
            query.StartDate = new DateTime(2008, 1, 1);
 
            Feed<Contact> feed = cr.Get<Contact>(query);
            foreach (Contact contact in feed.Entries)
            {
                Console.WriteLine(contact.Name.FullName);
                Console.WriteLine("Updated on: " + contact.Updated.ToString());
            }
        }


Any help would be greatly appreciated...

Mario.

-- 
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" 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://code.google.com/apis/contacts/community/forum.html

Reply via email to