Platform SDK: Exchange Server

Procedure for Editing Scripts

Using Microsoft Outlook, choose New Event, and then Edit Script. This creates a stub script that contains these empty subroutines:

You can add scripting code to any of these subroutine sections to control its functionality. To indicate that the script should not respond to an event of that type, just leave a section blank, or delete the section. Although this script could be written to respond to events of all four types, you could also choose to use separate scripts for each event.

Note: Using VBScript and JavaScript  Languages

You can write a script in VBScript, JavaScript, or with any other installed scripting engine. The scripting engine provides a generic scripting engine that identifies each scripting language you use to create your script.  The engine used to interpret and run the code is identified with the LANGUAGE attribute in a <SCRIPT> element.  The value of the LANGUAGE attribute identifies the programmatic identifier of the scripting engine to use.  By default, you normally have "VBScript" and "JavaScript" installed.  

For each type of language, an intrinsic object is passed representing it to the other scripting engines "namespace".    For example, if you have

<SCRIPT LANGUAGE="VBScript">

' …

   JavaScript.SomeFunction( "Hello") code here 
' …

</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">

function SomeFunction( Str ) {
  Script.Response = Str;  // from VBscript
}

</SCRIPT>

then SomeFunction from the "JavaScript" section are available to VBScript code using the name JavaScript.SomeFunction.  Similarly, the JavaScript code can access functions in the VBScript part using the name VBScript.<NAME>

If you mix the two languages and you are making cross-language calls, you need to prefix variable names with the programmatic identifier of the scripting engine; for example, VBScript.MyVar or JavaScript.MyVar.

Note that you cannot create script code on the fly by trying to set script code equal to these names.  Like all "objects," the intrinsic names VBScript and JavaScript are actually interfaces.  Avoid setting them.  If you do, you loose the connection to the other language's functions.  Also avoid putting the string literal"<SCRIPT>" in your script code.  This string is reserved for use by the scripting engine to delimit script text.  If you place the <SCRIPT> string in say string assignments, an exception will occur and the script will not execute.