S
Semut
Hello,
Firstly, I spawn a thread, and then I unmarshal what was passed in, which is
a MAPIFolder.
And then, I add an Outlook Contact Item. (assuming the MAPIFolder passed in
is a Contact folder)
The problem is that there is item added but the item is blank. I have put in
subject, title and last name but all these are not saved.
Why is it that the Outlook::_ContactItem::Save() not working?
I even tested this with Redemption::IMessageItem::Save. (I am using
GetItemFromID to obtain the MessageItem)
Same thing happen. In fact, redemption will crash at the Save function call.
Any reason why it can't be saved?????
Help.
Code snippet below
void threadFunc()
{
::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
LPDISPATCH lpMAPIFolder;
//unmarshalling of MAPIFolder.
LPSTREAM pData = g_Data;
if (pData )
{
::CoGetInterfaceAndReleaseStream
(
pIStreamForMAPI,
__uuidof(Outlook::MAPIFolderPtr),
(void**)&lpMAPIFolder
);
CComQIPtr<Outlook::MAPIFolder> spMAPIFolder(lpMAPIFolder);
CComPtr<Outlook::_Items> spItemsGet;
spMAPIFolder->get_Items(&spItemsGet);
CComPtr< IDispatch > spSingleItem;
spItemsGet->Add(CComVariant(Outlook:lContactItem), &spSingleItem);
ATLASSERT(spSingleItem);
CComQIPtr<Outlook::_ContactItem> spContactItem(spSingleItem);
if(spContactItem == NULL)
return;
spContactItem->put_Subject(T2W("hello"));
spContactItem->put_LastName(T2W("last name"));
spContactItem->put_Title(T2W("hello2"));
spContactItem->Save();
lpMAPIFolder->Release();
::CoUninitialize();
}
}
Firstly, I spawn a thread, and then I unmarshal what was passed in, which is
a MAPIFolder.
And then, I add an Outlook Contact Item. (assuming the MAPIFolder passed in
is a Contact folder)
The problem is that there is item added but the item is blank. I have put in
subject, title and last name but all these are not saved.
Why is it that the Outlook::_ContactItem::Save() not working?
I even tested this with Redemption::IMessageItem::Save. (I am using
GetItemFromID to obtain the MessageItem)
Same thing happen. In fact, redemption will crash at the Save function call.
Any reason why it can't be saved?????
Help.
Code snippet below
void threadFunc()
{
::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
LPDISPATCH lpMAPIFolder;
//unmarshalling of MAPIFolder.
LPSTREAM pData = g_Data;
if (pData )
{
::CoGetInterfaceAndReleaseStream
(
pIStreamForMAPI,
__uuidof(Outlook::MAPIFolderPtr),
(void**)&lpMAPIFolder
);
CComQIPtr<Outlook::MAPIFolder> spMAPIFolder(lpMAPIFolder);
CComPtr<Outlook::_Items> spItemsGet;
spMAPIFolder->get_Items(&spItemsGet);
CComPtr< IDispatch > spSingleItem;
spItemsGet->Add(CComVariant(Outlook:lContactItem), &spSingleItem);
ATLASSERT(spSingleItem);
CComQIPtr<Outlook::_ContactItem> spContactItem(spSingleItem);
if(spContactItem == NULL)
return;
spContactItem->put_Subject(T2W("hello"));
spContactItem->put_LastName(T2W("last name"));
spContactItem->put_Title(T2W("hello2"));
spContactItem->Save();
lpMAPIFolder->Release();
::CoUninitialize();
}
}