从 google hangouts meet 获取列表会议

Get the list meetings from google hangouts meet

我想问是否可以检索在 Java 中使用 Google Hangout Meet API 完成的会议列表? google了一下,还是想不通

更新 - 1: 使用 Google 日历,我做了:

        Calendar service = getCalendarService();
        List<Event> items = new ArrayList<Event>();
        String pageToken = null;
        do {
          Events events = service.events().list("service-account-esprit@my-first-project-2587777.iam.gserviceaccount.com").setPageToken(pageToken).execute();
          items = events.getItems();
          for (Event event : items) {
            System.out.println(event.getSummary());
          }
          pageToken = events.getNextPageToken();
        } while (pageToken != null);

方法 getCredentials() 是:

public static Credential getCredentials() throws IOException
{
    java.io.File clientSecretFilePath = new java.io.File(CREDENTIALS_FOLDER, CLIENT_SECRET_FILE_NAME);

    InputStream in = new FileInputStream(clientSecretFilePath);
    GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));

    SCOPES.add(CalendarScopes.CALENDAR_READONLY);

    GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES).setDataStoreFactory(DATA_STORE_FACTORY).setAccessType("offline").build();
    Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");

    return credential;
}

更新 - 2:

所以,我错过了启用 G Suite 域范围的委派。 我修复了 that capture 提出的问题 我将旧的 credentials.json 替换为 my-first-project-274515-ba944be8b749.json(创建服务后生成的文件帐户)。

然后,我做了Events events = service.events().list("service-account-esprit@my-first-project-2587777.iam.gserviceaccount.com").setPageToken(pageToken).execute();

我把日历分享给service-account-esprit@my-first-project-2587777.iam.gserviceaccount.com

我也启用了 Google 日历 Api。

但我得到了那个例外:

Exception in thread "main" java.lang.IllegalArgumentException at com.google.api.client.repackaged.com.google.common.base.Preconditions.checkArgument(Preconditions.java:108) at com.google.api.client.util.Preconditions.checkArgument(Preconditions.java:37) at com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.getDetails(GoogleClientSecrets.java:82) at com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow$Builder.(GoogleAuthorizationCodeFlow.java:197) at tn.esprit.spring.google.calendar.Calendar_Utils.getCredentials(Calendar_Utils.java:75) at tn.esprit.spring.google.calendar.Calendar_Utils.getCalendarService(Calendar_Utils.java:87) at tn.esprit.spring.google.calendar.Calendar_Utils.main(Calendar_Utils.java:95)

--> 我在 GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES).setDataStoreFactory(DATA_STORE_FACTORY).setAccessType("offline").build(); 上出错 我想不通。 你能告诉我我错过了什么吗? 任何建议表示赞赏。 非常感谢。

你可以试试:

Events events = service.events().list(user@entreprise.tn)
                .setOrderBy("startTime")
                .setSingleEvents(true)
                .execute();

HTH.