This code worked ok in Python 3.5.2. in the same machine.
In Python 3.7.0 it hangs up when you try to get the Appointment Properties Start or End. It hangs up just with the first request for Start or End. No error message appears.
Tested under Windows 10, both in Command Console and with Jupyter Notebook.
Any advice or other libraries needed to include?
import win32com.client
import datetime
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
calendar = outlook.GetDefaultFolder(9)
appointments = calendar.Items
appointments.Sort("[Start]")
appointments.IncludeRecurrences = "True"
#This block restrict the time range. Doesn't change the hang up
begin = datetime.date(2018, 9, 1) #year, month, day
end = datetime.date(2018, 10, 1)
print(f"Activities from: {begin}, to: {end}")
restriction = "[Start] >= '" + begin.strftime("%d/%m/%Y") + "' AND [End] <= '" +end.strftime("%d/%m/%Y") + "'"
print("restriction:", restriction)
restrictedItems = appointments.Restrict(restriction)
# The problem arise accessing as a unique item
appointment = restrictedItems[1]
print(appointment.Subject)
print(appointment.Organizer)
print(appointment.Start)
print(appointment.End)
# Also hangs up inside a loop of appointments
for appointment in restrictedItems:
print(appointment.Subject)
print(appointment.Organizer)
print(appointment.Start)
print(appointment.End)