How can I open an Outlook data file programmatically?

0

In my current environment, I have to run Outlook as administrator on my workstation and that doesn't play well with some of my other software that is using the Outlook 2010 Developer Reference to move messages around in the Outlook mailbox.

The only thing I've been able to do to keep from getting the error code 0x8004010F is to "Close" the most current Outlook Data File I use as permanent storage and then reopen it. However, I need to do that now programmatically. I can't find anything in the Outlook 2010 Developer Reference about opening/closing the data files but surely Outlook can do it.

How can I do this?


Clarification: When I say that I need to 'close then open' the data file, it is within the current session of the Outlook mail client. The act of closing/opening the data file allows Outlook to receive/process the commands to move messages within the Exchange storage space.

outlook
outlook-2010
asked on Stack Overflow Jul 22, 2013 by Keng • edited Jul 22, 2013 by Keng

1 Answer

1

The error is MAPI_E_NOT_FOUND. What exactly raises that error?

You can use Namespace.AddStore/AddStoreEx to add a PST store and Namespace.RemoveStore to close it. Keep in mind however that the PST provider will still keep the PST file locked for 30 minutes or until Outlook closes.


User contributions licensed under CC BY-SA 3.0