Hi,

Here is a small example that prints the contact's title and its email
addresses:

public static void printAllContacts(ContactsService contactsService)
        throws ServiceException, IOException {

//Request the feed
URL feedUrl = new URL("http://www.google.com/m8/feeds/contacts/
[email protected]/full?max-results=10000");
ContactFeed resultFeed = contactsService.getFeed(feedUrl,
ContactFeed.class);
System.out.println(resultFeed.getEntries().size());

for (int i = 0; i < resultFeed.getEntries().size(); i++) {

        ContactEntry entry = resultFeed.getEntries().get(i);

        System.out.println("\n" + entry.getTitle().getPlainText());
        System.out.println(" Id:" + entry.getId() );
        System.out.println(" Photo:" + entry.getContactPhotoLink().getHref
() );

        System.out.println("Email addresses:");
        for (Email email : entry.getEmailAddresses()) {
                System.out.print(" " + email.getAddress());
                if (email.getRel() != null) {
                        System.out.print(" rel:" + email.getRel());
                }
                if (email.getLabel() != null) {
                        System.out.print(" label:" + email.getLabel());
                }
                if (email.getPrimary()) {
                        System.out.print(" (primary) ");
                }
                System.out.print("\n");
        }
}
}

On Oct 9, 6:22 am, ॐ۞ ۞ ۞ |S|U||D|H |A۞ ۞ ۞ॐ <[email protected]>
wrote:
> Here is the code to retrieve the contact list that is only emails ...
> i really dont know how to return the first name or full of the emails
> retrieve..
>
>   public static void printDateMinQueryResults(ContactsService myService) {
>         try {
>             System.out.println("ddqq");
>             // Create query and submit a request
>             // URL feedUrl1 = new
>             // URL("
> http://www.google.com/m8/feeds/contacts/[email protected]/full";);
>             URL feedUrl = new URL(
>                     "https://www.google.com/m8/feeds/contacts/default/full
> ");
>
>             Query myQuery = new Query(feedUrl);
>             // myQuery.setUpdatedMin(startTime);
>             myQuery.setMaxResults(999999);
>
>             ContactFeed resultFeed = myService
>                     .query(myQuery, ContactFeed.class);
>             System.out.println("****" +
> resultFeed.getTitle().getPlainText());
>             List<ContactEntry> entry = resultFeed.getEntries();
>             for (ContactEntry ce : entry) {
>                 Name dd = ce.getName();
>
>                 if (dd != null) {
>                     System.out.println(dd.getFullName().getValue());
>
>                 }
>                 final List<Email> ee = ce.getEmailAddresses();
>                 final List<Im> mm = ce.getImAddresses();
>                 for (Im bl : mm) {
>                     System.out.println("---> " + bl.getAddress());
>                 }
>
>                 for (Email ss : ee) {
>
>                     System.out.println("==>" + ss.getAddress());
>                 }
>             }
>
>             // // Print the results
>             // System.out.println(resultFeed.getTitle().getPlainText() +
>             // " contacts updated on or after "
>             // + startTime);
>             // for (int i = 0; i < resultFeed.getEntries().size(); i++) {
>             // ContactEntry entry = resultFeed.getEntries().get(i);
>             // // We assume existence of a nameToPrintableString function
> that
>             // formats
>             // // the Name of a contact into a string suitable for printing.
>             // List<Email> ee=entry.getEmailAddresses();
>             // for(Email ss : ee) {
>             // System.out.println("==>"+ss.getAddress());
>             // }
>             // System.out.println("\t" + entry.getName());
>             //
>             // }
>         } catch (ServiceException e) {
>             e.printStackTrace();
>         } catch (IOException e) {
>             e.printStackTrace();
>         }
>     }
>
> On Thu, Oct 8, 2009 at 8:21 PM, Stijn Meurkens <[email protected]> wrote:
>
> > Hi,
> > I can retrieve a list of all contacts by doing a signed GET for
> >http://www.google.com/m8/feeds/contacts/default/full?max-results=100000
>
> > Unfortunately, this list does not include email addresses. Is it
> > possible to include email addresses, or do I have to fetch them one by
> > one?
>
> > Thanks.
> > Stijn
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to