I'm asking if it's possible to retrieve the lists of meetings done with Google Hangout Meet API in Java?. After googling, I can't figure it out.
UPDATED - 1: With Google Calendar, I made:
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);
Which the method getCredentials() is:
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;
}
UPDATED - 2:
So, I missed enable G Suite domain wide delegation. I fixed that as presented by that capture I replaces the old credentials.json by my-first-project-274515-ba944be8b749.json (file resulted after creating the service account).
Then, I made Events events = service.events().list("service-account-esprit@my-first-project-2587777.iam.gserviceaccount.com").setPageToken(pageToken).execute();
I share the calendar with service-account-esprit@my-first-project-2587777.iam.gserviceaccount.com
I enabled Google calendar Api, too.
But I got that exception:
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)
--> I got error on GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES).setDataStoreFactory(DATA_STORE_FACTORY).setAccessType("offline").build();
I can't figure it out.
Could you please tell me what I missed ?.
Any suggestion is appreciated.
Big thanks.
You can try:
Events events = service.events().list([email protected])
.setOrderBy("startTime")
.setSingleEvents(true)
.execute();
HTH.