Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Hey I have this small working sample which was made using the same calendar doc you referred too. Also it would help if you can give the stack trace along with the code.</p> <pre><code> public static void main(String[] args) throws IOException { HttpTransport httpTransport = new NetHttpTransport(); JacksonFactory jsonFactory = new JacksonFactory(); String clientId = "CLIENT ID"; String clientSecret = "CLIENT SECRET"; String redirectUrl = "urn:ietf:wg:oauth:2.0:oob"; String scope = "https://www.googleapis.com/auth/calendar"; String authorizationUrl = new GoogleAuthorizationRequestUrl(clientId, redirectUrl, scope) .build(); System.out.println("Go to the following link in your browser:"); System.out.println(authorizationUrl); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.println("What is the authorization code?"); String code = in.readLine(); AccessTokenResponse response = new GoogleAuthorizationCodeGrant(httpTransport, jsonFactory, clientId, clientSecret, code, redirectUrl).execute(); GoogleAccessProtectedResource accessProtectedResource = new GoogleAccessProtectedResource( response.accessToken, httpTransport, jsonFactory, clientId, clientSecret, response.refreshToken); Calendar calendarService = Calendar.builder(httpTransport, jsonFactory) .setApplicationName("YOUR_APPLICATION_NAME") .setHttpRequestInitializer(accessProtectedResource) .build(); try { com.google.api.services.calendar.model.CalendarList calendarList = calendarService.calendarList().list().execute(); while (true) { for (CalendarListEntry calendarListEntry : calendarList.getItems()) { System.out.println(calendarListEntry.getSummary()); } String pageToken = calendarList.getNextPageToken(); if (pageToken != null &amp;&amp; !pageToken.equalsIgnoreCase("")) { calendarList = calendarService.calendarList().list().setPageToken(pageToken).execute(); } else { break; } } } catch (Exception e) { e.printStackTrace(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload