Search code examples
c#outlook-redemptionpst

Prevent Redemption.dll from Automatically Attaching Created PST to Outlook


I am trying to create a PST file using Redemption.dll in C#, but the created PST file is automatically attached to Outlook. The PST file is successfully created at the selected location, but when I open Outlook, the PST appears under "My Outlook PST Folder" in the left pane. My goal is to have the PST file created without it being attached to Outlook automatically.

Here is the code I’m using with Redemption version 6.5.0:

`RDOSession session = new RDOSession();
RDOStore store = null;
RDOFolder rootFolder = null;
session.Logon(null, null, false, true, null, true);
store = (RDOStore)session.Stores.AddPSTStore(flspath, rdoStoreType.olStoreUnicode, "My Outlook PST Store");
rootFolder = store.IPMRootFolder;`

How can I modify this code to ensure that the PST file is not automatically attached to Outlook upon creation?


Solution

  • You can call Store.Remove after you are done.

    You can also create a separate PST-only profile - create a new instance of RDOSession and call RDOSession.LogonPstStore. Keep in mind that MSEMS provider has a bug that might prevent it from working property is there is a different MAPI session in the same process that also loads a PST file.