Open MrSurf67 opened 4 years ago
ok - sorted it.
Key (for groups) is using the function: schedule.get_events() to get the events.
schedule = account.schedule(resource='group:xxx')
q = schedule.new_query('start').greater_equal(dt.datetime(2020, 1, 1))
q.chain('and').on_attribute('end').less_equal(dt.datetime(2020, 12, 31))
events = schedule.get_events(query=q)
for event in events:
print(event)
Yep but get default calendar should also work. I don't know why it doesn't work
Has this functionality become broken, or more likely do I still not understand it?
I've found the id of my organisation's shared calendar and tried the following without success:
print(schedule.list_calendars()) group_calendar = schedule.get_default_calendar()
What I have managed is to swap out the urls in calendar.py, using the following and this allows the code to access the group calendar and read the events:
'calendar' instead of 'calendars' in list_calendars 'calendar/events' instead of the wierd url I get in get_events.
The test code:
schedule = account.schedule(resource='group:74d8aed8-e1dd-4b83-a700-0f1c7633a175') print(schedule.list_calendars()) group_calendar = schedule.get_default_calendar() events = group_calendar.get_events(include_recurring=False)
Everything worked well with local calendars and shared calendars in my local folder. However, when moving onto group calendars and the https://graph.microsoft.com/Group.Read.All scope, things have unravelled slightly and I thought that group:group_id was the way to approach this?