I am developing an applicaiton using Google Calendar API v3 and Service account mode to have access. My application seems able to create new calendar without problem, but when I am going to check the result using Google Calendar standard web app I can't see nothing. This is strange because fetching CalendarList return the proper calendar list. Someone know why this happens? There is some limitation with calendar created with Service Account?
Thank you for your help. Alberto
UPDATE 1 :
Here a snippet of my code
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId(SERVICE_ACCOUNT_EMAIL)
.setServiceAccountScopes(Collections.singleton(CalendarScopes.CALENDAR))
.setServiceAccountPrivateKeyFromP12File(new File(KEY_P12))
// .setServiceAccountUser("user@example.com")
.build();
Calendar service = new com.google.api.services.calendar.Calendar.Builder(httpTransport, JSON_FACTORY, credential)
.setApplicationName(APPLICATION_NAME).build();
com.google.api.services.calendar.model.Calendar content = new com.google.api.services.calendar.model.Calendar();
content.setSummary("A calendar");
service.calendars().insert(content).execute();
UPDATE 2 :
Someone suggest to me to add to credentials the service account user (then de-comment .setServiceAccountUser("user@example.com")
the code above, but it doesn't work. In this case I can't create neither a calendar and I receive when I call service.calendars().insert(content).execute();
and I receive
400 Bad Request
{
"error" : "access_denied"
}