Jul 232009
 

This tutorial will explain how to schedule outlook 2007 rules to run at specific time

1.  Open Notepad.

2.  Copy the code in the snippet and paste it into Notepad. Edit the code as needed.  We placed comments where things can/need to change.

'Change the following three constants as desired
Const SHOW_PROGRESS = True
Const INCLUDE_SUBFOLDERS = False
Const UNREAD_MSGS_ONLY = 2
Dim olkApp, olkSes, olkFolder, olkRule
Set olkApp = CreateObject("Outlook.Application")
Set olkSes = olkApp.GetNameSpace("MAPI")
'Change Outlook on hte next line to the name of your mail profile'
olkSes.Logon "Outlook"
Set olkFolder = olkSes.GetDefaultFolder(6)
For Each olkRule In olkSes.DefaultStore.GetRules
olkRule.Execute SHOW_PROGRESS, olkFolder, INCLUDE_SUBFOLDERS, UNREAD_MSGS_ONLY
Next
Set olkRule = Nothing
Set olkFolder = Nothing
olkSes.Logoff
Set olkSes = Nothing
Set olkApp = Nothing

4.  Save the file with a .vbs extension.

5.  Test the script by double-clicking it.  All of your rules should execute.

6.  Create a scheduled task using Windows Task Scheduler.

7.  Set the task to run this script.

You still need the original code to turn rules off when you leave and turn them back on when you return to the office.  If the rules are not turned off, then they will continue executing when you don’t wnat them to.

Incoming search terms:

  6 Responses to “How to schedule outlook 2007 rules to run at specific time”

  1. is there anyway to use this code with outlook 2003?

  2. Hi

    Good post, but I am still wonder how to establish rule fore folder random than default inbox
    for example I have second mailbox:
    \\My2mail\directory1

    Have you any ideas?

    best regards

  3. Realy this is help full.

    Do you have this code office 2010 version?

    Thanks.

  4. I was able to use this on office 2010 and it worked great.

    thanks

  5. Thanks this worked great. One question… Is it possible to set a parameter so I can execute a specific rule as opposed to all of my rule?

  6. Great stuff!

    Works perfectly with 2010.

    Cheers

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>