Gwyn Howell
Gwyn Howell

Reputation: 5424

How to manage CalendarList for another user

I am in the process of migrating Google Calendar API from V2 - V3. I need to update another users CalendarList. This was possible in V2 by overriding the requestor_id field on the OAuth token. But now that I am also using OAuth2, this technique doesn't work.

The request for listing CalendarLists is:

GET https://www.googleapis.com/calendar/v3/users/me/calendarList

So I presumed exchanging 'me' for the users email address would work ...

GET https://www.googleapis.com/calendar/v3/users/[email protected]/calendarList

... but it doesn't - the API returns a 404 Not Found error.

Is this functionality possible using Calendar API V3?

Upvotes: 0

Views: 252

Answers (1)

Michał Ziober
Michał Ziober

Reputation: 38720

It looks like you have to use Service Account authorization. Good description how to use it you can find on this page: Perform Google Apps Domain-Wide Delegation of Authority. It describes this process for Drive API, but you can use it for Calendar API v3 as well. Scopes for Calendar API you can find on this page: Authorizing Requests to the Google Calendar API. You have to understand one thing: when you want to work with different users - you have to create new Calendar service object for each user.

Upvotes: 1

Related Questions