Standalone CDO app to extract attachment from .msg

D

Daniel Hänle

Dear all,

I need to write a standalone app (exe with no GUI) in Visual Basic
that
does not require a running instance of Outlook in order to run.
The code only works locally: I have a .msg on disk that I need to open
and extract the attachment. I don't need to access anything on the
Exchange server.
I need to use method olapp.CreateItemFromTemplate("my_mail.msg") which
requires an Outlook Application object. How do I create it when not
having Outlook running? Do I really need a session object? Do I need
to login if I don't need to run against the Exchange server?
Everything is in CDO, of course.

Thanks for every hint,

Daniel
 
D

Dmitry Streblechenko

CDO does not expose anything related to the MSG files, you need Extended
MAPI (C++/Delphi) for that. Or you can use Redemption in case of VB/VBA (see
SafeMailItem.Import method).

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

Daniel Hänle

Hi Dmitry,

long time not see, hehe. Remember me, the former IBM guy from the MAPI-L
list?

You are right, of course MAPI would do the thing. But
want to stay within Visual Basic. There is this call

olapp.CreateItemFromTemplate("my_mail.msg")

which allows you to open a msg file and get an item object. It works, I
did it. Maybe it is not CDO but "Outlook Automation" or whatever they
call this API.
How could I invoke this call or get an Outlook.Application object
programmatically for a VB standalone app without having OL instance
already running?

Daniel



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
D

Daniel Hänle

Sure, MAPI would do it, but what about this call

olapp.CreateItemFromTemplate("my_mail.msg")

which works (I tried it from within OL)?
Can't I somehow invoke an object of type "Outlook.Application"
from a standlone app without having OL already running?

Daniel
 

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