Prototyping and debugging Exchange event sinks

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

    Requires Free Membership to View

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:

  1. Un-register the event sink .DLL.
  2. Stop the COM+ app for this event sink.
  3. Compile a new version of the event sink if this hasn't been done already.
  4. Refresh and restart the COM+ app.
  5. 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:

  • Topics Library: Exchange scripts and programming

    This was first published in May 2005

  • There are Comments. Add yours.

    TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

    REGISTER or login:

    Forgot Password?
    By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
    Sort by: OldestNewest

    Forgot Password?

    No problem! Submit your e-mail address below. We'll send you an email containing your password.

    Your password has been sent to:

    Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.