Standalone CDO app to extract attachment from .msg

  • Thread starter Thread starter =?ISO-8859-1?Q?Daniel_H=E4nle?=
  • Start date Start date
?

=?ISO-8859-1?Q?Daniel_H=E4nle?=

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
 
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
 
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
 
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
 
Back
Top