0
votes

I'm using OOM to create a folder using parentFolder.Folders.Add call (parentFolder is Outlook.Folder instance). The folder gets created just fine. However, soon after Outlook crashes (for instance, some other code caused a fatal error to occur) or just the computer's power was lost. Anyway, the MAPI session was terminated unexpectedly. In this case, next time I start Outlook I often don't see the created folder. Looks like the changes I made with OOM sometimes are not propagated to the underlying .PST file. It occurs even with normal non-Exchange accounts (so Exchange Cached mode is not an issue).

For me it's critical to know if the folder has actually been saved or not (because if I don't see it next time, the code thinks this folder was deleted intentionally and removes its counterpart from the remote server).

Maybe there is some property or method call to check if the changes made with OOM have actually been propagated to the persistent storage?

2

2 Answers

1
votes

No, you cannot do that unless you are using as online (as opposed to cached) profile connecting to an Exchange mailbox.

If you make a change to a PST store or a cached Exchange mailbox (OST), there is no way to ensure that the change gets committed - Outlook flushes the changes to the local PST/OST files periodically or on shutdown. If the Outlook processes crashes, all bets are off.

1
votes

As Dmitry stated, there is no specific methods or properties for that.

To make sure the folder is deleted intentionally you can handle the Folders.FolderRemove event which is fired when a folder is removed from the specified Folders collection. In all other circumstances, you may re-create the folder at startup if it doesn't exist yet.