Platform SDK: Exchange Server |
The following steps illustrate folder event processing and refer to elements in the diagram in Event Handling Architecture. In this example, "Folder 3" is one of several folders configured to have events monitored. Agents are registered for this folder to link certain events that occur to user-defined scripts contained in Folder 3.
Note – Synchronous versus Asynchronous Event Handling The Microsoft Exchange Event Service fires events asynchronously with respect to the Microsoft Exchange information store. This means that the store does not block your event script, or wait for it to run, before letting other processes access the folder or message. Other processes (Inbox Assistant rules, or even a fast user) could move, copy, delete, or modify the message before your script has a chance to complete or even run.
The Microsoft Exchange Scripting Agent is therefore suitable for typical, medium-volume workflow or administrative applications. It is not suitable for applications that would, for example, scan every piece of mail in or out of the system for viruses, or archive every message for government record-keeping purposes, because there is no guarantee that your scripts will see every message. A good example is trying to use OnMessageCreated events in your Outbox folder to process all outgoing mail. By the time your script runs, the message will already have been delivered and deleted from your Outbox.
Additionally, some of these types of scripting applications could face problems of scale. Depending on the application's purpose, you would either have to manually install a script in every folder for every user, or the volume would simply be too high to process with an interpreted scripting language like VBScript.