Hi all.
I'm trying to retrieve the contact photo into a bitmap but I can't
seem to figure out how to get my url to authorise.
I cant connect using the simple ClientLogin because it either doesnt
support (or i cant find how to) connect to it when you're behind a
proxy!
anyway so I'm connecting like this:
GContactService = new ContactsService("GoogleContactsC#Library");
GContactService.setUserCredentials(username, password);
WebProxy proxyObject = new WebProxy();
proxyObject = new WebProxy(host + ":" + port, true);
((GDataRequestFactory)GContactService.RequestFactory).Proxy =
proxyObject;
That then sets me up a connection, which works perfectly fine as I'm
getting all my contacts out using:
ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri
("default")); query.StartIndex = 0;
query.NumberToRetrieve = 999999;
ContactsFeed feed = GContactService.Query(query);
//Trying to get the auth token? probably wrong here!!
authToken = GContactService.QueryAuthenticationToken();
Now i can get the photoURI from a contact by using
string photoUri ="";
foreach (ContactEntry entry in feed.Entries)
{
photoUri = entry.PhotoUri.ToString();
}
And this is the point I want to be able to grab that photo from the
URI and load it into a bitmap stream.
So, i've got this so far....
WebClient Client = new WebClient();
Client.Proxy = proxyObject;
Client.Headers.Add("Authorization: AuthSub token=" + authToken );
mystream = Client.OpenRead(url);
Which tells me im not authorised and i get a 401 error
Any ideas? Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---