Please let others know how useful this tip is via the rating scale at the end of it. Do you have a useful Exchange or Outlook tip, timesaver or workaround to share? Submit it to our tip contest and you could win a prize.
Exchange event sinks are pieces of code that are triggered by specific Exchange events. For instance, an administrator can create an event sink that fires when a piece of e-mail is received, or when other specified conditions arise. This makes it possible to customize or add to Exchange's functionality in many ways.
Event sinks can be useful, but they can also be tricky. What works perfectly well in controlled testing may not work in a live environment at all, no thanks to unexpected interactions between user accounts and mailbox permissions, or the vagaries of e-mail in general. Because of this, if you're writing custom event sinks for your organization that are going to be deployed as compiled objects (.DLLs), the live debugging process can be painful and complicated.
.DLLs for event sinks not only have to be registered with the system, but run in the context of a specific COM+ application. If you have to take a .DLL offline and replace it with an updated version, the procedure usually goes something like this:
- Un-register the event sink .DLL.
- Stop the COM+ app for this event sink.
- Compile a new version of the event sink if this hasn't been done already.
- Refresh and restart the COM+ app.
- Re-register the event sink.
Since the only way to reliably test an event sink is in situ, un-registering and re-registering successive versions of the same component can become tiresome and time-consuming. One way to work around problems like this is to code a prototype version of the event sink in VBScript and then later convert it to a .DLL in VB6. First, the code used can be virtually identical; the changes needed to make a VBScript program work as a full Visual Basic application are minimal. Second, the VBScript code can be edited on the fly and does not need to be removed and re-registered when changed.
About the author: Serdar Yegulalp is editor of the Windows Power Users Newsletter and a regular contributor to SearchExchange.com.
Do you have comments on this tip? Let us know.
Related information from SearchExchange.com: