Как получить поле «Примечания» из API контактов Google - PullRequest
0 голосов
/ 25 января 2019

Я успешно получил контактную запись из контактов Google, но пока не смог получить поле «Заметки». Как я могу это сделать?

Это часть того, что я сделал до сих пор ...

    public static void main(String[] args) throws IOException, ServiceException, SQLException {
        System.out.println("Start elaboration");

        Credential credential =authorize();
        if (!credential.refreshToken()) {
        throw new RuntimeException("Failed OAuth to refresh the token");
        }

        ContactsService myService = new ContactsService(APPLICATION_NAME);
        myService.setOAuth2Credentials(credential);

        URL feedUrl = new URL("https://www.google.com/m8/feeds/contacts/default/full");
        Query Query = new Query(feedUrl);
        Query.setMaxResults(32767);
        ContactFeed feed=null;
        try {
            feed = myService.query(Query, ContactFeed.class);

        } catch (ServiceException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        for (ContactEntry contact : feed.getEntries())  {
              if (contact.hasName()) {
                  Name name = contact.getName();
                  if (name.hasFullName()) {
                    String fullNameToDisplay = name.getFullName().getValue();
                    if (name.getFullName().hasYomi()) {
                      fullNameToDisplay += " (" + name.getFullName().getYomi() + ")";
                    }
                  System.out.println("Full Name = " + fullNameToDisplay);
                  } 
              }

              /* 
               * insert here the code to retrive Notes Field
               */
        }
        System.out.println("End elaboration");
}
...