I am trying to get the email account associated with some shared mailbox whose email is sent as a parameter. The followed code works fine when I execute it on Outlook 2013. However, it throws a System.InvalidCastException on Outlook 2016.
public string GetUserSMTPAddressOfSharedMailbox(string email)
{
Redemption.IRDOStore store = RdoSession.GetSharedMailbox(email);
if(store != null && store.StoreAccount != null)
{
return store.StoreAccount.CurrentUser.SMTPAddress;
}
return null;
}
System.InvalidCastException: Unable to cast
COM object of type 'System.__ComObject' to interface type
'Redemption.IRDOSession'. This operation failed because the
QueryInterface call on the COM component for the interface with IID
'{E54C5168-AA8C-405F-9C14-A4037302BD9D}' failed due to the following
error: No such interface
supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr
pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
at Redemption.IRDOSession.GetSharedMailbox(Object NameOrAddressOrObject)