user1427661
user1427661

Reputation: 11774

Getting All Entries from a Multi-User Google Calendar

So I have an enterprise calendar that it is the default Google calendar of one of the managers at an organization. She has her own entries on the calendar, but there are also many entries that appear to have originally been inputted on other users' calendars and shared with or copied to this default calendar. I'm trying to use the Python Google Calendars API to get a list of all of the events on the calendar. Unfortunately, it's only listing the events that have been added by the manager, even though the manager can see all of the other events. Here is my code for retrieving the entries within a specific date range:

def dateRangeQuery(calendar_service, startDate, endDate):
    query = gdata.calendar.service.CalendarEventQuery('default', 'private', 'full')
    query.start_min = startDate
    query.start_max = endDate
    feed = calendar_service.CalendarQuery(query)
    for entry in feed.entry:
        print entry.title.text

Is there any way to retrieve the other users' entries without having their login information?

Sorry I'm not that familiar with Google Calendars itself. On further investigation, I'm pretty sure what's happening is that other users are keeping calendars and sharing certain events with the managers. So my question boils down to this: is there a way to list shared events using the Google Calendars API?

Upvotes: 0

Views: 1915

Answers (1)

Jay Lee
Jay Lee

Reputation: 13528

You should be using the new Google Calendar API v3 and the Google API Python Client. No use developing against an old, deprecated version of the API.

It sounds like the Calendar with all the entries on it is a resource Calendar. If that's the case, you should authenticate as a user that has ownership rights to the resource calendar but you should retrieve entries for the resource calendar, not the user's primary calendar:

events = service.events().list(calendarId='[email protected]').execute()

while True:
  for event in events.get('items', []):
    print event['summary']
  page_token = events.get('nextPageToken')
  if page_token:
    events = service.events().list(calendarId='[email protected]', pageToken=page_token).execute()
  else:
    break

Upvotes: 1

Related Questions