【问题标题】:Python - Outlook Response (Accept, Reject, etc.) Date/TimePython - Outlook 响应(接受、拒绝等)日期/时间
【发布时间】:2021-04-20 03:57:41
【问题描述】:

我正在开展一个项目,该项目涉及从多个人的 Outlook 中提取大量约会/会议数据。我试图找到的一条信息是每个与会者的响应,如果可能的话,还有响应发生的日期和时间。例如,如果 X 在 2015 年 4 月 21 日下午 12:31:00 向我发送会议请求,而我在 2015 年 4 月 21 日下午 1:30:00 接受了会议请求,我将如何获得后者两次?我一直在为此浏览 Microsoft 文档 (Link),但到目前为止还没有运气。

以下是 Python 的快速总结:

import win32com.client

outlook = win32com.client.Dispatch('Outlook.Application')
namespace = outlook.GetNamespace('MAPI')

recipient = namespace.createRecipient('Other Person')
resolved = recipient.Resolve()
sharedCalendar = namespace.GetSharedDefaultFolder(recipient, 9)

appointments = sharedCalendar.Items

for i in range(0,1):
    print appointments[i]
    print appointments[i].start
    print appointments[i].end
    print appointments[i].organizer
    print appointments[i].location
    print appointments[i].duration

    for j in range(0,len(appointments[i].recipients)):
        print 'recip, status: ' + str(appointments[i].recipients[j]) + ', ' + str(appointments[i].recipients[j].TrackingStatusTime)

【问题讨论】:

  • 我不知道这是否有帮助,但如果可能的话,我认为它会位于该站点周围的某个地方:link

标签: python outlook win32com


【解决方案1】:

【讨论】:

  • 是否可以获得每个收件人的回复时间?谢谢!
  • 当然,使用 Recipient.MeetingResponseStatus 属性。请注意,它只会在组织者日历文件夹中的约会上设置。
  • 我认为 MeetingResponseStatus 无法获得“ReplyTime”(请参阅​​ here)。
  • 有可能 - Recipient.TrackingStatusTime 将返回与会者发送响应的时间。
  • 太棒了。 Recipient.TrackingStatusTime 有什么警告吗?当我得到这个字段时,我正在检索几乎所有的 '01/01/01 00:00:00' 值。我正在引用 namespace.GetSharedDefaultFolder() 来获取此数据...这可能会限制我可以看到的信息吗?感谢您的帮助。
【解决方案2】:

这是另一种方式

import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")

inbox = outlook.GetDefaultFolder(6)
messages = inbox.Items
messages.Sort("[ReceivedTime]", True)

for i, msg in enumerate(messages):
    
    print(msg.MessageClass) # use this in condition

    if msg.MessageClass=='IPM.Note':
        print('This a Meeting')

    elif msg.MessageClass =='IPM.Schedule.Meeting.Request':
        print('This is a meeting Meeting')
    elif msg.MessageClass =='IPM.Schedule.Meeting.Resp.Pos':
        print('Accepted Response , POS = Positive')
    elif msg.MessageClass =='IPM.Schedule.Meeting.Resp.Tent':
        print('Accepted as Tentative ')
    elif msg.MessageClass == 'IPM.Schedule.Meeting.Resp.Neg':
        print('Declined Meeting , Neg = Negative')

    # Check only first 10 items, change the number as per requirement
    if i > 10:
        break 

https://docs.microsoft.com/en-us/office/vba/outlook/Concepts/Forms/item-types-and-message-classes

【讨论】:

    猜你喜欢
    • 2023-02-15
    • 1970-01-01
    • 1970-01-01
    • 2013-01-04
    • 1970-01-01
    • 2021-04-18
    • 2017-05-17
    • 2014-07-28
    • 2018-11-21
    相关资源
    最近更新 更多