accessing loose msgs

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Just wondering if there was a way of accessing an msg file. not an email
through mapi but an actual "c:\new email.msg"
 
Depends on what kind of item it is and what you want to do with it ... which
is?
 
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.
 
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".
 
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
 
Back
Top