Dan*_*Gal 4 python outlook pywin32 win32com outlook-2013
我正在尝试使用 Python win32com 库从 Outlook(2013) 获取事件,我设法做到了这一点,但是我无法获得它们的状态(已接受、暂定、已拒绝)。当我当前的代码获取所有事件时,找出它们的状态很重要。我在网上读到存在一个 AppointmentItem.ResponseStatus 属性,但是我没有设法使用它让它工作。谁能告诉我如何为 Python 实现这一目标?
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(9) # "9" refers to the index of a folder - in this case,
# the events/appointments. You can change that number to reference
# any other folder
events = inbox.Items
Run Code Online (Sandbox Code Playgroud)
小智 5
来自GetDefaultFolder(9)areAppointmentItem的项目及其属性可以在这里找到:https : //msdn.microsoft.com/en-us/library/office/ff862177.aspx#Anchor_4
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
calendar = outlook.GetDefaultFolder(9)
appointments = calendar.Items
for appointment in appointments:
print(appointment.ResponseStatus)
Run Code Online (Sandbox Code Playgroud)
ResponseStatuses 以整数形式返回,可以使用此表将其转换为状态:https : //msdn.microsoft.com/en-us/library/office/ff868658.aspx