gpt4 book ai didi

python win32com获取outlook事件(约会/ session )响应状态

转载 作者:行者123 更新时间:2023-11-28 17:26:09 29 4
gpt4 key购买 nike

我正在尝试使用 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

最佳答案

GetDefaultFolder(9) 中的项目是 AppointmentItem,它们的属性可以在这里找到: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)

ResponseStatuses 以整数形式返回,可以使用此表将其转换为状态:https://msdn.microsoft.com/en-us/library/office/ff868658.aspx

关于python win32com获取outlook事件(约会/ session )响应状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38899956/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com