IConverterSession->MAPIToMIMEStm

S

Scott McFadden

I used Microsoft's IConverterSession->MAPIToMIMEStm (exposed by Outlook
2003) to save an MSG into EML / RFC822 format.
I then turned around and tried to convert the eml file back to a MAPI MSG /
LPMESSAGE using the reverse call of IConverterSession->MIMEToMAPI.
When I invoke the MIMEtoMAPI call I get an Access Violation reading location
0.x00000000. Has anyone else had any luck using MAPIToMimeStrm?

Here is a code snippet of what I am doing:

hr = OpenStreamOnFile(MAPIAllocateBuffer, MAPIFreeBuffer, STGM_READ,
inMimeFile, NULL, &pMimeStream);

_ASSERTE(SUCCEEDED(hr));

hr=CoCreateInstance(CLSID_IConverterSession, NULL, CLSCTX_INPROC_SERVER,
IID_IConverterSession, (void **) &pConverterSession);

_ASSERTE(SUCCEEDED(hr));


pConverterSession->SetEncoding(IET_QP);

pConverterSession->SetSaveFormat(SAVE_RFC822);

hr = pConverterSession->MIMEToMAPI(pMimeStream, lpMessage , NULL, CCSF_SMTP
| CCSF_INCLUDE_BCC); <--access violation error ocurrs here

_ASSERTE(SUCCEEDED(hr));



scott
 
D

Dmitry Streblechenko

Does lpMessage point to a valid IMessage object?
You can play with IConverterSession in OutlookSpy (click Misc |
IConverterSession). Do you get an access violation there?
BTW, the best place to ask your Extended MAPI questions is the
microsoft.public.win32.programmer.messaging newsgroup.

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

Scott McFadden

Thanks for the tip. I wasn't aware that I had to pass a instantiated
IMessage (figured it was an output parm that gave you an instantiated
IMessage). Now I just need to figure out how to create a new empty /
disconnected IMessage on the fly. The end goal is to convert the eml to a
standalone mapi msg file on the file system.

thanks Dmitry
 
D

Dmitry Streblechenko

You can easily create IMessage on top of an MSG file (an existing or a newly
created one) - Google OpenIMsgOnIStg for numerous code snippets.

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