Please help - code to move messages?

  • Thread starter Thread starter Barbara
  • Start date Start date
B

Barbara

Hi!

I am currently working in an environment which is using Exchange
Server and relies heavily on email messages, consequently everyone
sends and receives masses of mail.

Unfortunately, as it is a charity, it is screwed down so tightly
against viruses and hackers that we are prevented from loading
programs or addins.
However, it is possible to write code.

I would like to relieve the pressure in my Boss's InBox by using code
to set up a custom rule (or similar) to move read messages to folders
stipulated by the user.

I am very new to programming Outlook and have recently started making
my way through Sue Mosher's book 'Microsoft Outlook Programming', but
it is a slow process, I haven't come up with anything yet and the
pressure is on me to come up with something.


I would very much appreciate your help and/or suggestions.

Many Thanks


Barbara (^-^)/

UK
 
You could handle the ItemChange event for the Items collection of the Inbox
folder. When an item is changed you get a handle to the item and can use
that to check the UnRead property. If it's False you can then move the item
to another folder.

I don't recall any specific ItemChange code but it's very similar to ItemAdd
code. Look at the ZapHTML code sample at
http://www.outlookcode.com/d/code/zaphtml.htm#cw to see how to set up an
ItemAdd handler. You can modify that to produce an ItemChange handler.
 
Move is the method of MailItem, Unread is its parameter.
For Each oNewItem In Folder.Items.Restrict("[Unread] = 0")

oNewItem.Move ... etc
 
Back
Top