2016-08-11 224 views
1

我想通過使用Python win32com庫從Outlook(2013)獲取事件,但我設法做到這一點,但是我一直無法獲得它們的狀態(接受,暫定,拒絕)。查找他們的狀態非常重要,因爲我現在的代碼可以獲取所有事件。我在網上讀到,存在一個AppointmentItem.ResponseStatus屬性,但我沒有設法使它使用它。任何人都可以告訴我如何可以實現這一點的Python?從GetDefaultFolder(9)python win32com獲取Outlook事件(預約/會議)響應狀態

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 

回答

0

項目是AppointmentItem S和它們的屬性可以在這裏找到: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) 

ResponseStatus ES以整數返回,這可以轉換成狀態與此表:https://msdn.microsoft.com/en-us/library/office/ff868658.aspx