Search code examples
pythonoutlookwin32com

Python - Outlook Response (Accept, Reject, etc.) Date/Time


I am working on a project that involves pulling a lot of appointment/meeting data from Outlook from multiple people. One piece of information that I am trying to find is the response for each attendee and, if possible, the date and time that the response happened. For example, if Person X sends me a meeting request on 4/21/2015 12:31:00 PM and I accepted the meeting request at 4/21/2015 1:30:00 PM, how would I get the latter of those two times? I have been browsing the Microsoft docs for this (Link) but have had no luck so far.

Here is a quick summary in 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)

Solution

  • AppointmentItem.ReplyTime and AppointmentItem.ResponseStatus