I am having an issue where I need to pull back the current event's listed in someones default Google calendar, perhaps for a week. I listed the best code example I can find below, but it does not have anything that points to the Oauth2 call in it. Also, I get an error for service. but I cannot find anything that would possibly reference it including the accessProtectedResource object.
Could someone explain what service is supposed to be, or a link to an example that will give me the calendar events after an Oauth2 call?
CalendarList calendarList = service.calendarList().list().execute();
while (true) {
for (CalendarListEntry calendarListEntry : calendarList.getItems()) {
System.out.println(calendarListEntry.getSummary());
}
String pageToken = calendarList.getNextPageToken();
if (pageToken != null && !pageToken.isEmpty()) {
calendarList = service.calendarList().list().setPageToken(pageToken).execute();
} else {
break;
}
}