Exception while accessing StoreAccount from Redemption Outlook library

25 Views Asked by At

I am trying to access the FreeBusyList from account configured in Outlook and using the Redemption dll. We are using Redemption dll in .Net to test the Outlook data. Code snippet:

RDOStores stores = OutlookRedemption.Instance.rdoSession.Stores; 
RDOFreeBusyRange list = stores.DefaultStore.StoreAccount.CurrentUser.FreeBusyList;
Getting below exception:
    System.InvalidCastException : Error in IMsgServiceAdmin::AdminProviders: MAPI_E_INTERFACE_NOT_SUPPORTED
    at Redemption.RDOStoreClass.get_StoreAccount()
    Client\Calendar\MeetingRequests\FreeBusy\CreateMeetingRequest.cs(193,0): at clientTests.Client.Calendar.MeetingRequests.FreeBusy.CreateMeetingRequest.CreateMeetingRequest_ZimbraFreeBusy_01()
---- UNHANDLED EXCEPTION ----
1

There are 1 best solutions below

0
Dmitry Streblechenko On

The exception is raised since you are most likely using Outlook's existing session by setting RDOSession.MAPIOBJECT to Namespace.MAPIOBJECT from OOM in a process other than outlook.exe, and MAPI profile management API has marshaling bugs that prevent the IMsgServiceAdmin and other profile interfaces from working correctly across process boundaries.

The good news is that you don't need that call: stores.DefaultStore.StoreAccount.CurrentUser is equivalent to just rdoSession.CurrentUser.