Is there a way to create an inMemory object of PersonalStorage type? I would like to open a .pst file from disk and load entirely into memory. Knowing that my .pst files can be up to and sometimes larger than 1GB I have plenty of memory to handle such an object. The need for this is to extract all the messages from the .pst file and process them individually doing some other work outside of the .pst file. This takes a very long time to extract 10K+ emails and when attempting to run in parallel for the IEnumrable
<MessageInfo> list and extract from the same .pst file using the PersonalStorage object throws all sorts of different errors.
basic code snipet used is below.
pstStore = PersonalStorage.FromFile(PSTFileName);
FolderInfo folder = pstStore.RootFolder.GetSubFolder(“Inbox”);
var messages = folder.EnumerateMessages();
Parallel.ForEach(messages, po,(message) =>
MapiMessage msg = new MapiMessage();
msg = pstStore.ExtractMessage(message); //<-continues to fail due to locking of .pst instead of in memory object accessible by all threads at the same time (note: threads of 4 or more see this issue).