You might want to ask here:
http://groups.google.com/group/google-contacts-api
(Also, for future reference, a stack trace is helpful when asking for help)
--
Ikai Lan
Developer Programs Engineer, Google App Engine
Blogger: http://googleappengine.blogspot.com
Reddit: http://www.reddit.com/r/appengine
Twitter: http://twitter.com/app_engine
On Mon, Dec 13, 2010 at 10:57 PM, Moretto mala...@gmail.com wrote:
Hi,
Im'trying to read gmail contacts from my GAE APP. So the following
class works fine at desktop app, but when i call getEmails method at
my servlet a excpetion occurs. Seems like im not allowed to do it.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.appspot.kshare.control;
import com.google.gdata.client.contacts.*;
import com.google.gdata.data.contacts.*;
import com.google.gdata.data.contacts.ContactFeed;
import com.google.gdata.data.contacts.ContactEntry;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author malacma
*/
public class ContactsControlUtil {
public static ListString getEmails(String user, String senha)
throws MalformedURLException, AuthenticationException, IOException,
ServiceException {
URL feedUrl = new URL(https://www.google.com/m8/feeds/
contacts/default/full);
ContactsService service = new ContactsService(Google-
contactsExampleApp-1);
service.setUserCredentials(user, senha);
ContactFeed cf = service.getFeed(feedUrl, ContactFeed.class);
ListString lEmails = new ArrayListString();
for (ContactEntry ce : cf.getEntries()) {
//System.out.print(ce.toString());
ListEmail lEmail = ce.getEmailAddresses();
for (Email em : lEmail) {
lEmails.add(em.getAddress());
}
}
return lEmails;
}
public static void main(String args[]) throws
MalformedURLException, AuthenticationException, IOException,
ServiceException{
System.out.print(getEmails(mala...@gmail.com,
));
}
}
--
You received this message because you are subscribed to the Google Groups
Google App Engine for Java group.
To post to this group, send email to
google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to
google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.
--
You received this message because you are subscribed to the Google Groups
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.