Scan outbox for new messages, and if attachment size > 5MB..

Mnemonic

Member
Joined
May 24, 2007
Messages
9
Programming Experience
1-3
Hey guys,

I have a request from our CIO to move messages larger than 5MB to a file share. Im new to programming outlook add-ins.

How would i go about scanning the outbox in real time without a performance burden to do the following:

1) If the attachment size is over 5MB, move to a file share

2) Inject a message that the file has been moved to a file server into the outbound message

Thanks for any help you can give!
 
Found this on here

Outlook, Recognise Email, Save Attachment, Move Email To A Subfolder

For Each Item In Inbox.Items
If get_bank(Sender) <> "unknown" Then
' Save any attachments found
For Each Atmt In Item.Attachments
' This filename path must exist! Change folder name as necessary.
Sender = Atmt.Parent.SenderEmailAddress
Sender = Right(Sender, Len(Sender) - InStrRev(Sender, "="))

ext = Atmt.Filename
ext = Right(ext, Len(ext) - InStrRev(ext, ".") + 1)
Filename = "S:\Loans\Data\For\Outlook\" & get_bank(Sender) & ext
'Atmt.SaveAsFile FileName

Atmt.SaveAsFile Filename
i = i + 1
Next Atmt
Item.Move myDestFolder
End If
Next Item

This saves the attachment and saves email to subfolder, with a bit of re-coding you could get it to do what you want.
 
Back
Top