I am working with Microsoft Outlook 2010 and with pyExchange. I am trying to list all the events scheduled between two dates as mentioned here in the docs. My code snippet is as below:
eventsList = service.calendar().list_events(
start=timezone("Europe/London").localize(datetime(2015, 1, 12, 1, 0, 0)),
end=timezone("Europe/London").localize(datetime(2015, 1, 14, 23, 0, 0)))
print eventsList
for event in eventsList:
print "{start} {stop} - {subject}".format(
start=event.start,
stop=event.end,
subject=event.subject
)
I have created events in my calendar manually using Outlook as well as by using pyExchange.
But when ever I execute the code snippet above I only get the following traceback:
<pyexchange.exchange2010.Exchange2010CalendarEventList object at 0x02056550>
Traceback (most recent call last):
File "C:\Users\p\Desktop\getEvent.py", line 41, in <module>
for event in eventsList:
TypeError: 'Exchange2010CalendarEventList' object is not iterable
Any suggestion why this happening and how to solve it? Thanks.
eventsList.events
instead. – jonrsharpe