Kira
Kira

Reputation: 1207

Outlook - CreateDispatch Exception

I'm trying to capture some Outlook events (It's a separate application not an Add-In). For that reason I have a class called CApplication defined as : class CApplication : public COleDispatchDriver and a class called CAppEventListener : class CAppEventListener : public IDispatch. I'm getting an exception at CreateDispatch method

m_pAppEventListener = new CAppEventListener();
m_pAppEventListener->CheckOutlookInProcess();
COleException l_oleExcep;

if(!m_pAppEventListener->m_OutlookApplicationInternal.CreateDispatch( _T("Outlook.Application" ),&l_oleExcep))
{
    CString szMsg;
    szMsg.Format( _T("CreateDispatch() failed with error 0x%08lx"), l_oleExcep.m_sc );
    AfxMessageBox( szMsg, MB_SETFOREGROUND );
    return 0;
}

And here is the message box that shows the exception code. Does anybody knows where could it come from?

enter image description here

Upvotes: 1

Views: 999

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66286

CO_E_SERVER_EXEC_FAILURE I usually raised if the security contexts of your app and Outlook are different.

Is your app running a regular GUI app or a task/service? Is either app running with elevated security privileges (Run As Administrator)?

Upvotes: 1

Related Questions