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.
Keng
  • 52,011
  • 32
  • 81
  • 111

1 Answers1

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.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Rats. I don't think that'll work since I need to keep my Outlook open the whole time so it'll keep the file locked. – Keng Jul 22 '13 at 13:55
  • What do you need to do with the PST file? – Dmitry Streblechenko Jul 22 '13 at 16:53
  • since I have a limited amount of space on the Exchange server, I have to move stuff out into a data file for permanent storage. – Keng Jul 22 '13 at 17:08
  • But unless you want to directly modify/delete the PST file, PST provider locking the file will not interfere with Outlook or other applications that use the Outlook Object Model or MAPI. – Dmitry Streblechenko Jul 22 '13 at 17:37
  • You can also process the PST file in a separate process (secondary exe) - if the PST file is only touched in that process, as soon as the secondary process exits, the lock will be released. You can use either Extended MAPI (C++ or Delphi) for that or Redemption (any language) - see RDOSession.LogonPstStore method http://www.dimastr.com/redemption/rdosession.htm - it will create and delete a temporary profile that will use the specified PST file. – Dmitry Streblechenko Jul 22 '13 at 17:39