N
Nauman Khan
Hi,
I am trying to use following code to copy the message from one folder to
other using MAPI. hRes is returned as S_OK at every stage but the message
does not get copied physically. Anything i am Missing ? Thanks in advance.
LPENTRYLIST lpEntryList = NULL;
int cValues = 1;
int cb = CbNewENTRYID(1);
hRes = MAPIAllocateBuffer(cb, (LPVOID *)&lpEntryList);
if (FAILED(hRes))
{
return FALSE;
}
ZeroMemory(lpEntryList, cb);
hRes = MAPIAllocateBuffer(
cValues * sizeof(SBinary),
(LPVOID FAR *)&lpEntryList->lpbin);
if (FAILED(hRes))
{
return FALSE;
}
lpEntryList->lpbin[0].cb = pInvitation->ulEntryCB;
lpEntryList->lpbin[0].lpb = (LPBYTE)pInvitation->lpMessageEID;
LPMESSAGE lpMessage = NULL;
ULONG ulObjType = NULL;
LPSPropValue lpProp = NULL;
hRes = m_pMDB->OpenEntry(pInvitation->ulEntryCB,
pInvitation->lpMessageEID,
NULL,//default interface
MAPI_MODIFY,
&ulObjType,
(LPUNKNOWN *) &lpMessage);
LPSPropValue sptMsgProps = NULL;
ULONG propCount;
// Move the Message to SENT folder
if (!FAILED(hRes))
{
hRes = m_UnsentFolder->CopyMessages(lpEntryList,
NULL,
m_SentFolder,
NULL,
NULL,
MESSAGE_MOVE );
if ( !FAILED(hRes) )
{
return TRUE;
}
I am trying to use following code to copy the message from one folder to
other using MAPI. hRes is returned as S_OK at every stage but the message
does not get copied physically. Anything i am Missing ? Thanks in advance.
LPENTRYLIST lpEntryList = NULL;
int cValues = 1;
int cb = CbNewENTRYID(1);
hRes = MAPIAllocateBuffer(cb, (LPVOID *)&lpEntryList);
if (FAILED(hRes))
{
return FALSE;
}
ZeroMemory(lpEntryList, cb);
hRes = MAPIAllocateBuffer(
cValues * sizeof(SBinary),
(LPVOID FAR *)&lpEntryList->lpbin);
if (FAILED(hRes))
{
return FALSE;
}
lpEntryList->lpbin[0].cb = pInvitation->ulEntryCB;
lpEntryList->lpbin[0].lpb = (LPBYTE)pInvitation->lpMessageEID;
LPMESSAGE lpMessage = NULL;
ULONG ulObjType = NULL;
LPSPropValue lpProp = NULL;
hRes = m_pMDB->OpenEntry(pInvitation->ulEntryCB,
pInvitation->lpMessageEID,
NULL,//default interface
MAPI_MODIFY,
&ulObjType,
(LPUNKNOWN *) &lpMessage);
LPSPropValue sptMsgProps = NULL;
ULONG propCount;
// Move the Message to SENT folder
if (!FAILED(hRes))
{
hRes = m_UnsentFolder->CopyMessages(lpEntryList,
NULL,
m_SentFolder,
NULL,
NULL,
MESSAGE_MOVE );
if ( !FAILED(hRes) )
{
return TRUE;
}