MAPI CopyMessages Problem

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;

}
 
D

Dmitry Streblechenko \(MVP\)

When do you invoke that code? Why do you open the message before moving it?
Do you release it before calling CopyMessages?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top