Schedule to quite Outlook via timer.... RRS feed

  • Question

  • Hi,

    I schedule timer to go off to close my outlook but, before it closes the outlook I want to schedule one of my rules to run and finishes before outlook is closed...

    any suggestion?

    Jeff Paarsa

    Jeff Paarsa

    Monday, January 13, 2014 4:36 AM

All replies

  • Hello Jeff,

    In the timer's event you can run rules programmatically. Note, you may use a separate event/timer for running rules and be sure that they are finished before you close Outlook programmatically. The Outlook object model provides the Execute method of the Rule class to apply a rule as a one-off operation regardless of whether Rule.Enabled is True. Use Rule.Enabled and then Rules.Save if you want to apply the rule consistently and persist the rules beyond the current session. Be aware, Outlook is not suited to background calls to its object model. If you use the Outlook Object Model in timer's events, you need a timer to be in the same thread or sync the timer thread context to the Outlook thread context. See the Is it a good idea (or not) to use a polling timer in an Outlook add-in to check for external inputs? thread for details.

    Monday, January 13, 2014 6:49 AM
  • Hello Eugene,

    Yes I do use two separate event/time for both Quit and forcing my other rule of Stripping to run and timer for Quit is 10-15 minutes after I start time of the Stripping Rule.  But I have noticed that stripping runs lot longer and each morning when I wake up I see a Dialog has poped out stating that Outlook can not quit at this time.   And when I click OK it crashes and restarts again...  I though if I can find a mechanizem to see if a rule running I wait then after finishing the running rules I quite. 


    Jeff P...  

    Jeff Paarsa

    Tuesday, January 14, 2014 5:50 AM
  • Hello Jeff,

    Unfortunately the Outlook object model doesn't provide any property or method for this. It looks like you just need to increase the time for processing Outlook items.

    Tuesday, January 14, 2014 3:05 PM