MajinBoo
MajinBoo

Reputation: 337

Using python O365: How to retrieve more than 25 entries when getting calendar events?

I use the following code to retrieve calendar entries:

from O365 import Account    
# get account element for calendars
schedule = account.schedule()
# get the main calendar
calendar = schedule.get_default_calendar()
# make a query that gets all events between a certain start and end date
begin = datetime.date.today()
end = begin + datetime.timedelta(days = 14)
query = calendar.new_query("start").greater_equal(begin)
query.chain('and').on_attribute('end').less_equal(end) 
# add all events to a variable
myEvents = calendar.get_events(query=query, include_recurring=True)

The problem is that I get a maximum of 25 entries from "get_events".

How do I generally go about issues like this? I tried to find the answer on the github repo for O365 but they do not seem to go into further detail on what functions exist in the library and what the respective parameters are. They just list examples.

Upvotes: 0

Views: 1335

Answers (1)

alphaz18
alphaz18

Reputation: 2766

according to the documentation here: https://o365.github.io/python-o365/latest/html/api/calendar.html#O365.calendar.Calendar.get_events

you can use the limit parameter to increase it to say 999. something like get_events(limit=500, *, query=None, order_by=None, batch=None, download_attachments=False)

Hope this helps you.

Upvotes: 1

Related Questions