Redemption的GetSharedMailbox中的System.InvalidCastException

时间:2017-06-27 00:21:32

标签: outlook outlook-redemption

我正在尝试将与其电子邮件作为参数发送的某个共享邮箱关联的电子邮件帐户。当我在Outlook 2013上执行它时,后面的代码工作正常。但是,它会在Outlook 2016上抛出System.InvalidCastException。

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)

0 个答案:

没有答案