Auto save Outlook Attachments

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

Guest

How can I, after a message has arrived and normal rules, like move to a folder if from a specific sender has been executed add a custom rule that check if their is an attachment or attachments and extract the attachment or attachments only and save the attachments only as is to a specified folder
 
You'd have to rely on custom code completely, rather than the Rules Wizard,
to do this effectively. Use this class module as a starting point:

Option Explicit
Dim WithEvents NewMailItems As Outlook.Items

Private Sub Application_Quit()
Set NewMailItems = Nothing
End Sub

Private Sub Application_Startup()
Set NewMailItems =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub NewMailItems_ItemAdd(ByVal Item As Object)
'THIS WILL FIRE FOR EVERY NEW E-MAIL; YOU CAN USE THE
'Item OBJECT TO WORK WITH THE PROPERTIES OF THE E-MAIL MESSAGE

Item.SaveAs "C:\Temp\mymessage.txt", olTXT
End Sub

Just instantiate this class in the Application_Startup event of the
ThisOutlookSession module. Add additional code to handle the current Item
object as you see fit (i.e. check the Attachments collection, use the Move
method to move it to a specified folder, save attachments to a local folder,
etc.).

If you are not a programmer, see http://www.slipstick.com/addins/auto.htm
for some utilities that may help you.


--
Eric Legault, B.A., MCP, MCSD, MVP - Outlook
ImagiNET Resources Corp.
http://www.imaginets.com


Revo said:
How can I, after a message has arrived and normal rules, like move to a
folder if from a specific sender has been executed add a custom rule that
check if their is an attachment or attachments and extract the attachment or
attachments only and save the attachments only as is to a specified folder
 
Back
Top