Microsoft KB Archive/290654

= OL2002: How to Create a Solution That Runs at a Specific Time Interval =

Article ID: 290654

Article Last Modified on 8/8/2007

-

APPLIES TO


 * Microsoft Outlook 2002 Standard Edition

-



This article was previously published under Q290654





SUMMARY
Microsoft Outlook does not provide built-in functionality that allows you to send mail or perform some other custom task at a specific time interval. However, as a developer, you can create this type of solution by using various developer technologies and operating system features. This article provides an overview of how you can begin to implement this type of solution.



MORE INFORMATION
IMPORTANT: This article describes how to create an Outlook solution to be used on a typical end-user computer. It does not take into account possible server-based solutions. For example, if you are using Microsoft Exchange Server 5.5 Service Pack 1 (SP1) or later, there is an OnTimer event that you can associate with a server-based folder. For more information on implementing this event, see the following Microsoft Web site:

http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/exchserv/events_6a5v.htm

Outlook does not have what is commonly called a &quot;timer&quot; event. These events typically have the ability to run at a specified time interval, such as every 15 minutes, or once a day.

However, there are a variety of ways to create a custom solution that implements this functionality. The design of the solution depends on many factors, including:
 * The operating system that you are using.
 * Whether or not you have Microsoft Visual Basic or a developer tool that allows you to create executable files.
 * Whether or not you have installed Windows Scripting Host.
 * Whether or not you have installed or will install the Outlook E-mail Security Update.

The following sections explain the main points you need to consider when you design this type of solution.

Develop the Task to Be Repeated
First, you must determine how to use the Outlook object model to perform the custom operation once. It is often useful to use Outlook Visual Basic for Applications to prototype this part of the solution. You can later move this code to another development environment after it is functioning correctly. For example, if you want to send a custom mail message once a day, you can adapt the routine to programmatically send a mail message from an example available in the following Microsoft Knowledge Base article:

209948 ACC2000: How to Use Automation to Send a Microsoft Outlook Message

Microsoft Windows 9x-based Computers
If you are using a Windows 9x-based operating system, you can use the Windows Task Scheduler to run any executable file at a specific time interval. This executable can be a compiled application that was created by using a COM-compliant development environment, such as Microsoft Visual Basic, or you can use a Visual Basic Script file (.vbs) if you have Windows Script Host installed on the computer. For additional information on Windows Script Host, see the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/library/ms950396.aspx

Microsoft Windows NT or Microsoft Windows 2000 Computers
If you are using Windows NT or Windows 2000, the Task Scheduler runs in a service. You cannot automate the Outlook object model from a service, or a process that is spawned from a service. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

237913 INFO: Outlook Object Model Unsuitable to Run in a Windows Service

Important considerations:
 * If you can use the Collaboration Data Objects (CDO) 1.2x object model to automate your task, consider using that object model because it can be used from a service.
 * Instead of using the Task Scheduler service, use Microsoft Visual Basic or another COM-compliant development environment to create a stand-alone application. In this application, implement timer-based functionality, such as by using the Timer Control. To use this solution, the application must be running continuously on the computer.

