How to use the python pypff
library to find the start and end time of an event in the outlook calendar (*.pst)?
Using my recursive function, I get access to calendar events as messages, and then I get all the attributes.
In the list of attributes with type datetime
I get the time of creation, modification, etc. – I do not need them.
one message <pypff.message object at 0x0000021CC3698150>
-- one_attr=client_submit_time 2024-01-23 02:25:38.495000 <class 'datetime.datetime'>
-- one_attr=creation_time 2024-01-23 02:25:18.160000 <class 'datetime.datetime'>
-- one_attr=delivery_time 2024-01-23 02:25:38.495000 <class 'datetime.datetime'>
-- one_attr=modification_time 2024-01-23 09:34:04.661000 <class 'datetime.datetime'>
Then, through record_sets, I get 8 more entries with datetime type, which have different entry_types.
entries record_set <pypff.record_set object at 0x0000021CC36080D0>
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(2024, 1, 23, 2, 25, 38, 495000) one_entry.entry_type=57
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(2024, 1, 23, 2, 25, 38, 495000) one_entry.entry_type=3590
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(2024, 1, 23, 2, 25, 18, 160000) one_entry.entry_type=12295
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(2024, 1, 23, 9, 34, 4, 661000) one_entry.entry_type=12296
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(2024, 1, 23, 6, 30) one_entry.entry_type=32772
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(2024, 1, 24, 9, 0) one_entry.entry_type=32773
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(2024, 1, 23, 6, 30) one_entry.entry_type=32774
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(2024, 1, 24, 9, 0) one_entry.entry_type=32775
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(2024, 1, 23, 2, 25, 38, 495000) one_entry.entry_type=32882
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(2024, 1, 23, 6, 30) one_entry.entry_type=32888
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(4501, 1, 1, 0, 0) one_entry.entry_type=32890
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(2024, 1, 23, 6, 30) one_entry.entry_type=32942
* one_entry.value_type=64 one_entry.data_as_datetime=datetime.datetime(2024, 1, 24, 9, 0) one_entry.entry_type=32943
This is how the event is produced in Outlook itself:
def getID(f, level = 0, findAttr=None, ix=None):
methods = dir(f)
getAttr(f, skip_staff=True, findAttr=findAttr, skipEnum=False)
enumses = []
if 'record_sets' in methods:
enumses.append(f.record_sets)
if 'sub_folders' in methods:
enumses.append(f.sub_folders)
if 'sub_items' in methods:
enumses.append(f.sub_items)
if 'sub_messages' in methods:
enumses.append(f.sub_messages)
if 'entries' in methods:
enumses.append(f.entries)
if ('sub_messages' in methods) and (findAttr is not None):
enumses.append(f.sub_messages)
for idx0, one in enumerate(enumses):
for idx, one2 in enumerate(one):
getID(one2, findAttr=findAttr, level = level+1)
`
How to understand which entry_type corresponds to the beginning and end of an event in the calendar?
Or is there any other way to get the subject, Start, End of each event?
You’ll need to look up the property IDs for AppointmentStartWhole and AppointmentEndWhole. The actual entry type for these is dynamic (for a given PST file) and I am not familiar enough with pypff to advise you further on how to look them up.