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 <[email protected]> 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 List<String> 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);
>
>
>        List<String> lEmails = new ArrayList<String>();
>        for (ContactEntry ce : cf.getEntries()) {
>            //System.out.print(ce.toString());
>            List<Email> 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("[email protected]",
> "XXXXXXXXXXXX"));
>    }
> }
>
> --
> 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
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> 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 [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-appengine-java?hl=en.

Reply via email to