On the Exchange Server, the Exchange Event Service runs under a specific account, usually the Exchange Service Account. In order for printing to succeed from an event script, the account requires a default printer in its registry hive.
- In Control Panel, open the Services applet, select the Microsoft Exchange Event Service, and then open the Startup dialog box. Note which account the service runs under.
- Open User Manager (Programs/Administrative Tools (Common)/User Manager for Domains). View the domain in which the Exchange server resides. Add the account noted in step 1 to either the Administrators group or the Power Users group.
- Log on to the Exchange Server as the account noted in step 1. Add a printer to the system and make it the default printer.
- Log on to a client computer as a user that has permissions to create an event script and add the following code to a Microsoft Exchange 5.5 public folder:
<SCRIPT RunAt=Server Language=VBScript>
Option Explicit
' DESCRIPTION: This event is fired when a new message is added to the folder.
Public Sub Folder_OnMessageCreated
script.response = "Message Created -"
PrintScript
script.response = script.response & "- Finished"
End Sub
Sub PrintScript
Dim objprint
Set objprint = CreateObject("PrintMsgProj.PrintMsgCls")
objprint.PrintMsg
End Sub
</SCRIPT>
- Create an ActiveX DLL which uses the Print object to print a text string:
- Start a new project in Microsoft Visual Basic and select ActiveX DLL. Class1 is created by default; change the name to "PrintMsgCls".
- From the Visual Basic Project menu, select Project1 Properties. Change the Project name to "PrintMsgProj" and the Project Description to "Print EV Script Test Object". Click OK to close the Project Properties dialog box.For additional information, click the article number below
to view the article in the Microsoft Knowledge Base:
281630 How To Configure Visual Basic DLL Project Properties to Run in IIS, MTS, or COM+
- Paste the following code into the General Declarations section of PrintMsgCls:
Public Sub PrintMsg()
Printer.Print "The OnMessageCreated Event Has Fired!"
Printer.EndDoc
End Sub
- Save the project. From the File menu, click Make PrintMsgProj.dll. You are now finished creating your ActiveX DLL project, but you still need to test it.
- Create a Microsoft Transaction Server (MTS) package. For additional information, see the following article in the Microsoft Knowledge Base:
223406 How To Create an Empty MTS Package to Add Components for ASP
- Test the script. If nothing prints, check the script log for error information.