How to save a email, sent out, as a file

D

DPM

Hi,

What I need is to save an email which is sent out from MSO as a file, which
is a frozen copy of the mail sent.

1. To do the above I need to find out the mail from Sent Items for the mail
which was sent out from Outbox.
What I know is the EntryId changes and there is no other property to create
a link between these 2 mail items
ie.
After issuing loMailItem.Send(), how do I get hold of the mail from sent
items, to issue loMailItem.SaveAs() and create a frozen copy ?

2. I noticed that MS Outlook has a option 'Not to save a copy in Sent
Items', in this case how to I create a file with the frozen copy ?

Could someone please give some hints.
 
S

Sue Mosher [MVP-Outlook]

1) Before you call Send, change the value of the BillingInformation property to some string. When the MAPIFolder.Items.ItemAdd event fires on the Sent Items folder, check the value of BillingInformation to see if it contains the marker you set. If it does, call SaveAs.

2) The best you can do in that case is save a copy of the unsent item.
 
D

DPM

Sue,

Thanks.
It would be great if you could help me with the further problems too.

1) Rather than waiting until MAPIFolder.Items.ItemAdd event to fire, is
there a method to read the sent mail item immediately,
as our programs which communicate with Outlook will have to wait until the
mail is sent ?
ie.
If there is an problem with the internet that blocks mails being sent out.

2) Saving a copy from the Drafts folder, results in an editable msg file.
But from Sent items it's a frozen copy.
Can I create a frozen copy from the Drafts folder ?



1) Before you call Send, change the value of the BillingInformation property
to some string. When the MAPIFolder.Items.ItemAdd event fires on the Sent
Items folder, check the value of BillingInformation to see if it contains
the marker you set. If it does, call SaveAs.

2) The best you can do in that case is save a copy of the unsent item.
 
S

Sue Mosher [MVP-Outlook]

1) Even if you send items immediately (the techniques for which depend on your Outlook version), you still have to wait until the item is in Sent Items if you want the sender and time information to be in the item you save.

2) No .msg file is itself directly editable. If you open it and click Save, you save a copy back to the Outlook folders. The .msg file is not updated unless you choose Save as and replace the original .msg file. Also, the body of the "frozen" message can be edited and saved back into Outlook or used to replace the .msg file. All the user has to do is choose Edit | Edit Message.

If you want the user to be unable to replace the .msg file (as above), you'd need to set the file as read-only (not something Outlook methods can do).

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
D

DPM

Thanks.


1) Even if you send items immediately (the techniques for which depend on
your Outlook version), you still have to wait until the item is in Sent
Items if you want the sender and time information to be in the item you
save.

2) No .msg file is itself directly editable. If you open it and click Save,
you save a copy back to the Outlook folders. The .msg file is not updated
unless you choose Save as and replace the original .msg file. Also, the body
of the "frozen" message can be edited and saved back into Outlook or used to
replace the .msg file. All the user has to do is choose Edit | Edit Message.

If you want the user to be unable to replace the .msg file (as above), you'd
need to set the file as read-only (not something Outlook methods can do).

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 

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