Reputation: 1207
When I try to process incoming emails (whithin NewMailEx
method) I got an exception if I call the GetItemFromId
method (an access violation). Doesn't Namespace.GetItemFromId
method require storeId as a second parameter? what value should I prvide as a store Id in case I'm not interested in which Inbox the event was raised. In other words I want only to retreive informations about the received email regardless which account (inbox) it belongs to.
CMailItem m_mailItem = NULL;
CApplication l_application;
l_application.CreateDispatch("Outlook.Application");
CNameSpace l_namespace = l_application.GetNamespace(_T("MAPI"));
CString ItemId((pDispParams->rgvarg)->bstrVal);
m_mailItem = l_namespace.GetItemFromID(ItemId, /*whatIdToProvide*/??);
I tried to pass an emty value but this didn't work.
Here is the GetItemFromId definition (automatically generated)
LPDISPATCH GetItemFromID(LPCTSTR EntryIDItem, const VARIANT& EntryIDStore)
{
LPDISPATCH result;
static BYTE parms[] = VTS_BSTR VTS_VARIANT;
InvokeHelper(0x2109, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,EntryIDItem, &EntryIDStore);
return result;
}
Upvotes: 0
Views: 367
Reputation: 66286
For all optional parameters, you need to pass a variant of type VT_ERROR with the value of DISP_E_PARAMNOTFOUND.
Upvotes: 1