问题
I'm trying to fetch rooms (added from calendar.google.com) service account (created from https://console.cloud.google.com/iam-admin/serviceaccounts) in spring boot project.
I had one service account which I created 4-5 month ago, it was working and it is still working with the 3 specific rooms.
But if I add service account mail to other rooms, then these rooms are not returned in the project.
I did all the steps written here:
https://developers.google.com/identity/protocols/OAuth2ServiceAccount
https://support.google.com/a/answer/1034381?hl=en
Also, I tried removing the service account email from the room's "Share with specific people" list in Calendar, and then added it back (this helped sometimes in the past).
But the re-added room was also not returned in my project.
I'm using this method from java to get the rooms.
https://developers.google.com/calendar/v3/reference/calendarList/list
This look like a bug, so do you know how can I work around this?
回答1:
If you shared the resource calendar with the Service Account through the UI, by adding the corresponding email in Settings and sharing > Share with specific people
, the calendar might not have been added to the CalendarList.
In order to make sure that a calendar is added to the CalendarList of a Service Account, you should use the API and call calendarList.insert.
Update:
There are currently several open issues in Issue Tracker regarding Service Accounts in Calendar. The situation you are experiencing is most probably related to that: check this, this and this, for example.
Meanwhile, I don't think using the API can be avoided. Maybe you could develop some kind of UI to make it less painful?
I hope this is of any help.
来源:https://stackoverflow.com/questions/59325643/gsuite-resources-cant-be-shared-with-service-account