Catastrophic failure followed by MAPI_E_INTERFACE_NOT_SUPPORTED when trying to AddPstStore

0

I am trying to add pst store from outlook addin using Redemption with the code:

RdoSession = Redemption.RedemptionLoader.new_RDOSession();
RdoSession.MAPIOBJECT = (AddinModule.CurrentInstance as AddinModule).OutlookApp.Session.MAPIOBJECT;
string path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Outlook\mystore.pst";
RDOStores stores = RdoSession.Stores;
RDOStore store = stores.AddPSTStore(path, Outlook.OlStoreType.olStoreDefault, "test");

Line stores.AddPstStore throws System.Runtime.InteropServices.COMException (0x8000FFFF): Catastrophic failure and it creates mystore.pst in correct location with the size of 265 KBs. New store/data file is not displayed in outlook and it does not apear in RdoSession.Stores on next execution. So my program tries to create it again (since it didint found it) and then same line crashes with:

System.InvalidCastException: Error in IMsgServiceAdmin::AdminProviders: MAPI_E_INTERFACE_NOT_SUPPORTED

Using office PIAs code works without any problems: https://msdn.microsoft.com/en-us/library/office/bb612380.aspx

I would keep redemption code since there is much more logic around it. I just moved these 5 lines to the begining of function to isolate the problem.

outlook-addin
outlook-redemption
asked on Stack Overflow Jun 23, 2015 by Velja Radenkovic • edited Aug 14, 2017 by Cœur

1 Answer

0

MAPI has a few marshaling bugs in the profile management interfaces (such as IMsgServiceAdmin).

Try to replace setting the RDOSession.MAPIOBJECT property with callimg RDOSession.Logon.

Is you code running in a Outlook addin or a standalone app?


User contributions licensed under CC BY-SA 3.0