Hi,
I have successfully created an Outlook add-in project in Visual Studio
2005.
I'm programming in ATL.

I'm wondering how one could create an appointment?

Here's some sample code...


STDMETHODIMP CConnect::OnConnection(IDispatch *pApplication,
AddInDesignerObjects::ext_ConnectMode /*ConnectMode*/, IDispatch
*pAddInInst, SAFEARRAY ** /*custom*/ )
{
pApplication->QueryInterface(__uuidof(IDispatch),
(LPVOID*)&m_pApplication);
pAddInInst->QueryInterface(__uuidof(IDispatch),
(LPVOID*)&m_pAddInInstance);

CComQIPtr <Outlook::_Application> spApp(pApplication);
ATLASSERT(spApp);
m_spApp_Event_New_Mail = m_spApp_Event_Send_Mail = m_spApp = spApp;


//////////////////////// Application
event ////////////////////////////////////

HRESULT hr = NULL;//DispEventAdvise((IDispatch*)spExplorer);

hr =
AppEvents::DispEventAdvise((IDispatch*)m_spApp_Event_Send_Mail,&__uuidof(Outlook::ApplicationEvents));
if(FAILED(hr))
return hr;

hr =
AppEvents_New::DispEventAdvise((IDispatch*)m_spApp_Event_New_Mail ,&__uuidof(Outlook::ApplicationEvents));
if(FAILED(hr))
return hr;

spApp->ActiveExplorer(&m_spApp_Event_Explorer);
hr =
ExpEvents::DispEventAdvise((IDispatch*)m_spApp_Event_Explorer,
&__uuidof(Outlook::ExplorerEvents));
if(FAILED(hr))
return hr;


CComPtr <Outlook::_NameSpace> olNs;
CComQIPtr <Outlook::Recipient> currUser;
CComBSTR bstr_temp("");

CComQIPtr <Outlook::_Application> m_spOutlookApp(pApplication);
ATLASSERT(m_spOutlookApp);
m_spOutlookApp = spApp;
m_spOutlookApp->get_Session(&olNs);

if(olNs == NULL)
return -1;

olNs->get_CurrentUser(&currUser);


currUser->get_Name(&bstr_temp);
CString test1 = CString(bstr_temp);
MessageBox(NULL, test1, "connect", MB_OK);

return S_OK;
}

Thanks!

/Samuel
29 Oct 2007Create Appointments in Outlook 2003 using ATL.Samuel.cyprian@gmail.com
All times are in (US) Eastern Daylight Time (GMT -4:00)