I have a PST file with messages. I need to extract all attachments in messages using Python and save them separately in another directory with the same names as they actually have. Please tell me how I can do this?
I want to add one important caveat: I am developing a program for Linux, and more specifically, I use Ubuntu.
In Outlook Object Model, call
Application.Session.AddStore, retrieve the new Store object from theApplication.Session.Storescollection (AddStoredoes not return the newStoreobject), callStore.GetRootFolderto get the top levelMAPIFolderobject, recursively process itsMAPIFolder.FoldersandMAPIFolder.Itemscollections to extract messages. For eachMailItemobject, process its attachments (MailItem.Attachmentscollection) and callAttachment.SaveAsFile.