accessing loose msgs

K

khcharles

Just wondering if there was a way of accessing an msg file. not an email
through mapi but an actual "c:\new email.msg"
 
S

Sue Mosher [MVP-Outlook]

Depends on what kind of item it is and what you want to do with it ... which
is?
 
K

khcharles

the msg file is a outlook email item that was parsed out from a pst. I would
like to extract out the attachments from them. So let's say that there is an
msg file with an office document as an attachment. I would like to be able
to save that document, doc, rtf, xls, whatever, into it's own file.

in a nutshell i'd like to be able to programmatically open up loose email
files and perform something analogous to a "save as" on it's attachments.
 
K

khcharles

Let me be more explicit

I have a file "C:\email.msg"

it is an outlook email item. inside this email there is an attachment that
is an excel file named "report.xls"

I want to extract email attachments from loose email files with msg file
extensions and save the attachment as a file. In this case I want
"c:\report.xls".
 
S

Sue Mosher [MVP-Outlook]

Since you don't care anything about the details of the .msg file itself,
only its attachments, this is pretty easy to do. Use the
Namespace.GetItemFromTemplate method with the path to the .msg file as the
argument. The item that method returns will be a new unsent MailItem whose
Attachments collection you can then iterate.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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