Are you a world traveler? ZoneTick is a cool utility that'll help you stay in touch over multiple time zones!
 
Debugging Folder Scripts  
Nik Okuntseff  MS Exchange Server Programming 

Debugging Folder Scripts

You can use Microsoft Script Debugger to debug Exchange folder scripts.
 

Installing Microsoft Script Debugger

This tool is not a part of Exchange server installation. You can download it from Microsoft web site. This site changes fast, so the following reference may not work for you. However, I had successfully downloaded it from here on September 07, 1998:

http://msdn.microsoft.com/scripting/

Before you do it, however, check your system. According to MSDN documentation Microsoft Script Debugger also comes with a number of other products such as Microsoft IIS (4.0), and Microsoft Internet Explorer (4.0). You may have it already installed. You may search through the system registry for "Microsoft Script Debugger" string, or the file system for msscrdbg.exe file.
 

Using Microsoft Script Debugger

After you have installed Microsoft Script Debugger on Exchange Server computer you may start using it. Microsoft Script Debugger supports only local debugging. In fact, you need to be logged on interactively under the account that Microsoft Exchange Event Service uses, otherwise the debugger will not be launched correctly. It may start, but would not break where necessary, and would not display VBScript code. Also, subsequent logon with Event service account may not function either until you reboot the system.

To break into the debugger you need to modify a script by either adding use stop statement if you are using VBScript, or debugger statement for JavaScript. For example, for my sample in the previous section, I could do the following:

Public Sub Folder_OnMessageCreated
    Dim SourceMsg
    Dim ReplyMsg
    Dim Recipient
 
    'Launch Microsoft Script Debugger
    stop

    'Create a new message
    Set ReplyMsg = EventDetails.Session.Outbox.Messages.Add

    'Set subject and body
    ReplyMsg.Subject = "Hello, world!"
    ReplyMsg.Text = "Hello, world!"
 
    'Address the message
    Set Recipient = ReplyMsg.Recipients.Add
    Set SourceMsg = EventDetails.Session.GetMessage(EventDetails.MessageID, Null)
    Recipient.Name = SourceMsg.Sender
    Recipient.Type = 1 'This means CdoTo
    Recipient.Resolve(False)

    'Send the message
    ReplyMsg.Send
End Sub

When you save this script and then post a message to a folder, a Microsoft Script Debugger screen with your script should appear on Exchange server computer with the stop statement highlighted. You may execute one statement at a time and examine what happens in detail.
 

[ Contents | Home ]

Send comments and suggestions to niko@wrconsulting.com
Copyright © 1997-1998 by Nik Okuntseff