M
Mike M.
I have a program that uses the Outlook Object Model to gather info from a
calendar. Since upgrading to Outlook 2003 I am trying to avoid the Outlook
Object Security warning dialog when I get the calendar item body. I am
trying to use the GetMAPIOBJECT() method of the AppointmentItemPtr to see if
using that interface will allow me to get the body text without the warning.
I have tried two methods for the mapiobject; coerce the returned point into
an IMessage pointer and do a QueryInterface() on the returned IUnknown
pointer. Neither succeeds.
If I coerce the pointer I get an exception when I try to use any method of
it. For example: lpIMsg->get_To(&buf);
If I use hr = ptr_Mapi->QueryInterface(CDO::IID_IMessage, (void **)&lpIMsg)
it fails with an interface not supported error (0x8004002).
Code snippets below.
Any suggestions?
TIA
#include <cdosys_i.c>
#include <CDOSys.h>
using namespace CDO;
Outlook::MAPIFolderPtr& aFolder
Outlook::_AppointmentItemPtr aItem;
IUnknownPtr ptr_Mapi;
CDO::IMessage *lpIMsg;
HRESULT hr;
int count=aFolder->GetItems()->GetCount();
aItem = aFolder->GetItems()->Item(index);
Group=_strdup(aItem->Subject);
// Try to get the mapi object
ptr_Mapi = aItem->GetMAPIOBJECT();
lpIMsg = (CDO::IMessage*)(IUnknown*)ptr_Mapi;
// hr = ptr_Mapi->QueryInterface(CDO::IID_IMessage, (void **)&lpIMsg);
// Description = _strdup(aItem->Body);
// Use the mapiobject instead of Object Model
BSTR buf;
if(lpIMsg)
{
lpIMsg->get_To(&buf);
// release the message
// lpIMsg->Release();
// lpIMsg = NULL;
}
calendar. Since upgrading to Outlook 2003 I am trying to avoid the Outlook
Object Security warning dialog when I get the calendar item body. I am
trying to use the GetMAPIOBJECT() method of the AppointmentItemPtr to see if
using that interface will allow me to get the body text without the warning.
I have tried two methods for the mapiobject; coerce the returned point into
an IMessage pointer and do a QueryInterface() on the returned IUnknown
pointer. Neither succeeds.
If I coerce the pointer I get an exception when I try to use any method of
it. For example: lpIMsg->get_To(&buf);
If I use hr = ptr_Mapi->QueryInterface(CDO::IID_IMessage, (void **)&lpIMsg)
it fails with an interface not supported error (0x8004002).
Code snippets below.
Any suggestions?
TIA
#include <cdosys_i.c>
#include <CDOSys.h>
using namespace CDO;
Outlook::MAPIFolderPtr& aFolder
Outlook::_AppointmentItemPtr aItem;
IUnknownPtr ptr_Mapi;
CDO::IMessage *lpIMsg;
HRESULT hr;
int count=aFolder->GetItems()->GetCount();
aItem = aFolder->GetItems()->Item(index);
Group=_strdup(aItem->Subject);
// Try to get the mapi object
ptr_Mapi = aItem->GetMAPIOBJECT();
lpIMsg = (CDO::IMessage*)(IUnknown*)ptr_Mapi;
// hr = ptr_Mapi->QueryInterface(CDO::IID_IMessage, (void **)&lpIMsg);
// Description = _strdup(aItem->Body);
// Use the mapiobject instead of Object Model
BSTR buf;
if(lpIMsg)
{
lpIMsg->get_To(&buf);
// release the message
// lpIMsg->Release();
// lpIMsg = NULL;
}