Get contacts by group name using gdata-contacts

531 Views Asked by At
 public static void printDateMinQueryResult(
        ContactsService myService, DateTime startTime) throws ServiceException,
        IOException
{

    URL feedUrl = new       URL("https://www.google.com/m8/feeds/contacts/[email protected]/full");
    Query myQuery = new Query(feedUrl);
    myQuery.setUpdatedMin(startTime);
    myQuery.setMaxResults(Integer.MAX_VALUE);
    **myQuery.setStringCustomParameter("group" ,"Friends");**

    ContactFeed resultFeed = myService.query(myQuery, ContactFeed.class);

    System.out.println("resultFeed.getEntries().size()" + resultFeed.getEntries().size());
    for (int i = 0; i < resultFeed.getEntries().size(); i++)
    {
        ContactEntry entry = resultFeed.getEntries().get(i);
      System.out.println("\t" + entry.getTitle().getPlainText());

        for (Email email : entry.getEmailAddresses())
        {
            System.out.println(" " + email.getAddress());

       }
    }
}

This gives me the result of all my email contacts .

I want email contacts by each group .

Eg : Friends,Family etc...

So In freinds list there may be 100 email contacts and in family 5 and so on .

How can get by its group name.

1

There are 1 best solutions below

3
On

add this line

myQuery.setStringCustomParameter("group", "groupId")