Closed GoogleCodeExporter closed 9 years ago
Original comment by yanivin...@gmail.com
on 28 Apr 2010 at 3:27
Hi,
I tried the same, but could not able to get contact list in my account.:
The code snippet is below:
<code>
//Setup Oauth
GoogleOAuthParameters oauthParam = new GoogleOAuthParameters();
oauthParam.setOAuthConsumerKey("810057834155.apps.googleusercontent.com");
oauthParam.setOAuthConsumerSecret("duJ77pNlETvfEDUIns1TXGZ4");
oauthParam.setOAuthType(OAuthType.TWO_LEGGED_OAUTH);
// set the feedURL (googleAccount = you@yourdomain.com)
URL contactsFeedUrl = null;
try {
contactsFeedUrl = new URL("http://www.google.com/m8/feeds/contacts/default/full" + "?xoauth_requestor_id=" + "vikash.kumar@gmail.com");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Init the service and set the auth
ContactsService contactsService = new ContactsService("atos-guestbook");
try {
contactsService.setOAuthCredentials(oauthParam, new OAuthHmacSha1Signer());
} catch (OAuthException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// The query that will retrieve all contacts
//Query myQuery = new Query(contactsFeedUrl);
//System.out.println("max results :: " + myQuery.getMaxResults());
// Execute the request
try {
// ContactFeed resultFeed = contactsService.getFeed(myQuery, ContactFeed.class);
ContactFeed resultFeed = contactsService.getFeed(contactsFeedUrl, ContactFeed.class);
System.out.println("resultFeed.getEntries().size() " + resultFeed.getEntries().size());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
</code>
Please suggest.
My requirement is to fetch all the contact list of the gmail user who is
accessing an application deployed on Google Appengine.
Thanks.
Original comment by vikash.c...@gmail.com
on 31 Aug 2012 at 6:57
Original issue reported on code.google.com by
thomas.r...@gmail.com
on 11 Apr 2010 at 2:46