[C++] error on CreateItem

  • Thread starter Thread starter cyan21
  • Start date Start date
C

cyan21

hello,

I have some problems when I want to create an item ( email, appointment
).
the IDisptach pointer returned is null, how can I fix this ?

yann.


hr = olapp.CoCreateInstance(__uuidof(Outlook::Application), NULL,
CLSCTX_SERVER);
SUCCEEDED(hr);

hr = olapp->raw_CreateItem(Outlook::olAppointmentItem, &pDisp);
//pDisp = olapp->CreateItem(Outlook::olAppointmentItem);
SUCCEEDED(hr);

ATLASSERT(pDisp); /// ERROR
appt = pDisp;
 
the error mentions pDisp was null after CreateItem.....

I found out a another error occured before CreateItem, I fixed it,
stopped and then restarted Outlook........It worked fine.

It's weird.....
 
Back
Top