How can I parse and read an outlook pst file in Python?
The following are the steps to parse a PST file and extract its information in Python. Load the PST file using PersonalStorage.from_file () method. Get the folders collection in PST using PersonalStorage.root_folder.get_sub_folders () method. Retrieve the information of the folders such as name, number of items, etc.
Searching the Internet for accessing Outlook PST-Files with Python gives very little results (and most of the stuff shown is outdated). Does anyone know how to read a PST with or without a library?
PST files are capable of keeping data of messages, contacts, calendars, events, etc. It is used by popular Microsoft softwares such as MS Outlook, Exchange, and Windows Messaging. In certain cases, you may need to parse a PST file and extract data from it programmatically.
The following steps show how to access the contacts in a PST file in Python. Load the PST file using PersonalStorage.from_file () method. Get reference of the contacts folder using get_predefined_folder (StandardIpmFolder.CONTACTS) method.
pypff is a python wrapper for the C library libpff that allows you to access email and the directory structure of Pst files within python.
Do a make of the library with the specified command to install the python bindings. Then you should be able to open up the python console and browse through Pst files.
import pypff
pst = pypff.file()
pst.open("MyPst.pst")
pst.close()
There are more examples on the libraries website. However, I found that there wasn't enough functionality in the library yet. For instance, you can read emails and the directories, but there isn't anything for attachments yet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With