Mike Kalen
Mike Kalen

Reputation: 21

Google Calendar v3 - Get all users with access to a calendar

This seems like such a basic thing, but I can't for the life of me figure out how to get a simple listing of all users with access to a calendar. If my understanding of the API is correct, I would have to log in as each user, pull which calendars that user has access to, and repeat for every user.

Upvotes: 2

Views: 629

Answers (1)

carpenter
carpenter

Reputation: 1210

You can view the access control list (Acl) with the following API call:

GET https://www.googleapis.com/calendar/v3/calendars/{calendarId}/acl?key={YOUR_API_KEY}

And after you have created your service the C# looks like :

Acl acl = service.Acl.List("primary").Execute();
foreach (AclRule rule in acl.Items)
{
    Console.WriteLine(rule.Id);
}

acl.Items is a list of items which you can iterate to get the Id of each user you have shared the calendar with.

If you aren't looking for the default calendar then you can swap "primary" to be the id of your calendar.

Upvotes: 1

Related Questions