Dijji / XstReader

Xst Reader is an open source viewer for Microsoft Outlook’s .ost and .pst files, written entirely in C#. To download an executable of the current version, go to the releases tab.
Microsoft Public License
513 stars 72 forks source link

PstFileAttachmentExporter : Export all file attachments from command line #24

Closed stephenjannin closed 4 years ago

stephenjannin commented 4 years ago


Export all attachments from a given pst file from command line. This tool is written in .net core for maximum portability and is using Xst Reader classes without the UI.

Dijji commented 4 years ago

I like this. I'm tempted to just merge it and cry hurrah!, good code, more functionality, excellent. I also love the idea of running the code on the Mac. There were remarkably few exclusions required to get there, too.

However, thinking a little more, it feels like a part of a bigger picture that needs thinking through even if we only implement this part of it. Otherwise we risk getting caught out with a particular piece that just does not fit into the whole in any coherent way.

How would this fit in to command line support for exporting email bodies with their attachments, with an attachment folder per email, which is what is available in the context menus today?

What happens to email threads where a document is being sent backwards and forwards being reviewed and changed? All the attachments would typically have the same file name. How does the user make sense of the collisions?

What happens if the user wants to know where a particular attachment came from? How do they trace it back to its source?

How would this work with large, sparsely populated folder structures such as are typical of .ost files? Most of the generated folders would be a) useless and b) empty. Should the command line allow the specification of the folders to be exported? Or should it just be that empty folders just not created?

Should the user be allowed to override the target export directory as part of the command?

What do you think about these questions?

Dijji

stephenjannin commented 4 years ago

Hello,

I was quite in a hurry to simply extract all attachment files from a 20Gb pst archive for my wife, and I had no time for extra checks : it does overwrite if a file with same name already exists, and I didn't put in place a real argument parser to specify the extract directory. Probably the next steps that I could imagine : 1/ commit this proposition, and make further evolutions depending on the time you/I have 2/ create a shared library (in .net standard ?)

As it's your project and I don't know what you have in mind, feel free to commit or not, and improve step by step.

stephenjannin commented 4 years ago

I finally removed the overwrite of existing files + fixed some unsupported directory names (ending with ' ', or containing invalid characters. The 20Gb archive is now well extracted :)

Dijji commented 4 years ago

I'm liking this better all the time!

stephenjannin commented 4 years ago

Sucessfully extracted a significant amount of attachments from archives. Finally files are overwritten depending on the message received date. We keep only the last one.

image

Dijji commented 4 years ago

I'm going to pull your code into a new branch called CommandLine, and make you a contributor in case you feel inspired to write more code.

The next two tasks will be:

What you think?

Dijji

Dijji commented 3 years ago

FYI: I have finally incorporated your code into release 1.14, which includes command line support for exporting emails and properties as well as attachments, with some refinements, like being able to specify the source Outlook folder, and flatten the output into a single directory. It also contains a portable version.

Thanks again for your contribution, which is (mostly) still there.