CDOLive LLC The Premier Resource for Microsoft Collaboration Data Objects             

Public Folder Update Notification

This first version of this sample (pfalert.zip) sends a new message to a particular distribution list if a new item is posted to a public folder, including a hyperlink in the message body. This hyperlink includes the subject of the newly arrived message. If you click on the hyperlink the message is opened:

The second version of this sample (pfalert1.zip) sends a new message to a particular distribution list if a new item is posted to a public folder, using a specific message class. If the appropriate Microsoft Outlook form (pfalertform.zip) is installed on the Microsoft Exchange organization forms library, the form will be shown if the user opens the new message. The Microsoft Outlook form gives the user the ability to choose what he wants to do with this alert (open, cancel, dismiss), including the option to unsubscribe from the distribution list:

Known Issues

Don't hide the mailbox or the public folder from the Global Address List (GAL), because the Microsoft Exchange Server Scripting and Routing script will fail to run if the mailbox or the public folder is not visible in the GAL.

Microsoft Exchange Server Scripting and Routing scripts are not running synchronously. It can take up to 60 seconds before the script fires.

The name of the distribution list is hardcoded with a constant in the Microsoft Exchange Server Scripting and Routing script. A possible solution to give more flexibility is to use a prefix and then add the folder name (e. g. "PFAlert-" & oFolder.Name) to build the name of the distribution list. But be aware that the name of the distribution list must be unique otherwise the script will fail to run.

The hyperlink, which is added in the message body must be changed to fit to the public folder structure. However, it is possible to create this link by reading the public folder hierarchy tree dynamically. But if you have a complex public folder structure this could become a performance issue.

Prerequisites

Make sure that Microsoft Exchange Server 5.5 with the Microsoft Event Service is installed and running properly. For more information about the Microsoft Exchange Server Scripting and Routing please take a look at The Secrets of Exchange Server Scripting and Routing.

Checked Build

If you would like to use this sample with another language version of Microsoft Exchange Server or Microsoft Outlook, it is possible that the sample will not work without modifications. Please consult the source code for more information. This sample is built and checked for a proper function using the following environment:

  • Microsoft Windows NT Server 4.0, with Service Pack 3/4/5/6a, US English - International
  • Microsoft Exchange Server 5.5, with Service Pack 1/2/3, US English - International
  • Microsoft Outlook 98, with Security Patch 2 (aka. outptch2), US English - International
  • Microsoft Outlook 2000, US English - International
Installation and Configuration
Component Description
'PFAlert' Mailbox The mailbox, which is used to send the alerts to the distribution list.

To create the mailbox start the Microsoft Exchange admin program and add a new recipient called 'PFAlert'. Associate the Exchange Server Service account to this mailbox, to make sure that the Event Script can run without problems. In the 'Permissions' tab of the mailbox add the NT account of yourself to make sure that you can open the mailbox and install the Microsoft Exchange Server Scripting and Routing script later.

Use the Microsoft Exchange admin program to add the 'PFAlert' mailbox to the 'Folders\System Folders\Events Root\EventConfig_<Your Servername>' folder with 'Author' (or greater) permissions to make sure that this mailbox can create and modify Microsoft Exchange Server Scripting and Routing scripts.

Also use the Microsoft Exchange admin program to add the 'PFAlert' mailbox to the particular public folder, where you want to install the Microsoft Exchange Server Scripting and Routing script, with 'Owner' permissions. Otherwise you cannot see the 'Agents' tab on the properties of the particular public folder.

If you don't see the folder 'Folders\System Folders\Events Root\EventConfig_<Your Servername> in the Microsoft Exchange admin program it is possible that the Microsoft Exchange Event Service is not installed or you are not running Microsoft Exchange Server 5.5. For more information please take a look at 'The Secrets of Exchange Server Scripting and Routing', Installation.

Create a new MAPI profile on your machine for the Exchange Server Service called 'PFAlert' and add the mailbox 'PFAlert' to the profile.
A Particular Public Folder A public folder of your choice. All new messages, which are arriving at this particular public folder will fire the 'PFAlert' Microsoft Exchange Server Scripting and Routing script.
pfalert.zip (3 Kbyte) Scripting and Routing Script, using a hyperlink in the message body The PFAlert Exchange Server Scripting and Routing script.
You have to modify the script as described following, to fit to your public folder structure and the name of the distribution list of your choice.

Enter the name for the distribution list to which you want to have the alerts sent. It is stored in the constant g_Const_DL and the default setting is 'PF - Alert'. However, you can enter any name you like, but make sure that you enter a valid display name of a distribution list and don't hide the distribution list from the Microsoft Exchange Directory, otherwise the Scripting and Routing script will fail to run properly.

If you want to use the url in the message body to access the new posted item make sure that you change the url to fit your public folder structure.

"<outlook://Public Folders/All Public Folders/" & oFolder.Name & "/~" & oCurrentMsg.Subject & ">"

It must look similar to the line above, were 'oFolder.Name' is the name of the public folder which hosts the Microsoft Exchange Scripting and Routing script. If this folder is not in 'Public Folders\All Public Folders' you have to add all subfolders separated with a '/'. The 'oCurrentMsg.Subject' contains the subject of the new message and is used to open the message with the Microsoft Outlook client.

To install the script, start the Microsoft Outlook client and logon with the mailbox 'PFAlert'. Select the particular public folder and right click on it to choose the properties. If you are not able to see the 'Agents' tab you may not have installed Microsoft Outlook 97 8.03 (or later), the Server Scripting add-on is not installed in Microsoft Outlook 97/98 or the permissions are not set properly. For more information please take a look at 'The Secrets of Exchange Server Scripting and Routing', Permissions and Security.

Open the Microsoft Exchange Scripting and Routing script with notepad and choose 'Edit', 'Select All' and copy it to the clipboard. Open the properties of the particular public folder and select the 'Agents' tab. Choose 'New...',  enter the agent name 'PFAlert' and choose 'A new item is posted to this folder' from the 'When the following event(s) occur:' list. Choose 'Edit Script...' and choose 'Edit', 'Select All' in the editor which is opened. Paste your Microsoft Exchange Scripting and Routing script in the editor and choose 'File', 'Exit'. You now will be asked to save the changes in a particular file. Don't bother about the filename select 'Yes' and exit all dialog boxes by choosing 'OK'.

To allow the Microsoft Exchange Event Service to update this information wait about 5 minutes and then you can try to start testing your solution.

pfalert1.zip (3 Kbyte) Scripting and Routing Script, using a custom message class If you want to use the version which is using a custom message class simply install the script and add the custom Outlook form the the organization forms library as described below.

You have to modify the script, described as follows, to fit to your public folder structure and the name of the distribution list of your choice.

Enter the name for the distribution list which you want to have sent the alerts to. It is stored in the constant g_Const_DL and the default setting is 'PF - Alert'. However, you can enter any name you like, but make sure that you enter a valid display name of a distribution list and don't hide the distribution list from the Microsoft Exchange Directory, otherwise the Scripting and Routing script will fail to run properly.

To install the script, start the Microsoft Outlook client and logon with the mailbox 'PFAlert'. Select the particular public folder and right click on it to choose the properties. If you are not able to see the 'Agents' tab you may not have installed Microsoft Outlook 97 8.03 (or later), the Server Scripting add-on is not installed in Microsoft Outlook 97/98 or the permissions are not set properly. For more information please take a look at 'The Secrets of Exchange Server Scripting and Routing', Permissions and Security.

Open the Microsoft Exchange Scripting and Routing script with notepad and choose 'Edit', 'Select All' and copy it to the clipboard. Open the properties of the particular public folder and select the 'Agents' tab. Choose 'New...',  enter the agent name 'PFAlert' and choose 'A new item is posted to this folder' from the 'When the following event(s) occur:' list. Choose 'Edit Script...' and choose 'Edit', 'Select All' in the editor which is opened. Paste your Microsoft Exchange Scripting and Routing script in the editor and choose 'File', 'Exit'. You now will be asked to save the changes in a particular file. Don't bother about the filename select 'Yes' and exit all dialog boxes by choosing 'OK'.

To allow the Microsoft Exchange Event Service to update this information wait about 5 minutes and then you can try to start testing your solution.
pfalertform.zip (7 Kbyte) Outlook form The Microsoft Outlook 98/2000 form, which is used to show the new alert message.

Click on the Outlook form template to start it and choose 'Disable Macros' if the macro warning dialog is displayed. To publish the form to the organization forms library on your Microsoft Exchange Server, change to the form design mode (in Microsoft Outlook 98: 'Tools', 'Forms', 'Design This Form') and publish the form to the organization forms library (in Microsoft Outlook 98: 'Tools', 'Forms', 'Publish Form').

Use the same message class inside the Microsoft Exchange Server Scripting and Routing script and with the Microsoft Outlook form. This sample assumes that the message class 'IPM.Note.PFAlert' is used inside the Microsoft Exchange Server Scripting and Routing script and the form name 'PFAlert' to publish the Microsoft Outlook form to the Microsoft Exchange Server organization forms library.