I am posting this to help clarify and update the documentation for:
http://code.google.com/apis/contacts/docs/3.0/developers_guide_java.html#retrieving_without_query
I think this section was a re-post of the 2.0 guide and it does not
work like that anymore.
  ContactFeed resultFeed = myService.getFeed(feedUrl,
ContactFeed.class);
will only get you the first page (25) entries.

How it works now:

First create a helper method:

public static ContactFeed retrieveAllContacts(ContactsService
myService, URL metafeedUrl)
                                                throws
AppsForYourDomainException, ServiceException, IOException {

        ContactFeed allContacts = new ContactFeed();
        ContactFeed currentPage;
        Link nextLink;
        //String [] oAuthId = metafeedUrl.toString().split("\\?"); //un-
comment if using OAuth

        do {
        currentPage = myService.getFeed(metafeedUrl, ContactFeed.class);
        allContacts.getEntries().addAll(currentPage.getEntries());
        nextLink = currentPage.getNextLink();
                if (nextLink != null) {
                      //metafeedUrl = new URL(nextLink.getHref() + "&" + oAuthId
[1]);   //un-comment If using OAuth
                        feedUri = new URL(nextLink.getHref()); //comment this 
line if using
OAuth
                }
        } while (nextLink != null);

        return allContacts;
}
NOTE! Read the inline OAuth comments

Now just replace the old line and you get all the entries.
                        ContactFeed resultFeed = retrieveAllContacts(myService, 
feedUrl);

Hope this helps.

--

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].
For more options, visit this group at 
http://groups.google.com/group/google-contacts-api?hl=.


Reply via email to