Exchange Server Scripting Agent Sample Script

Auto-Categorize  (AUTOCAT.TXT)

AutoCategory is a sample script that utilizes the onNewMessage and
OnChange event. It contains a list of hard coded keywords that are
searched for in message body of a new or changed message. If found
the Keywords field of that message is updated with the found
hardcoded keywords. Clients like Microsoft Outlook can then use
the Keywords field to sort, filter, or create categorized views
based on message content.

INSTALLING THE SAMPLE:

1.   Make sure that Event Service is installed and running on your
     Exchange Server.

2.   Ensure that you have given yourself permission to install &
     run scripts on this server. See the "Microsoft Exchange Server
     Getting Started Guide" for further information.

3.   Open the "AUTOCAT.TXT" file using Notepad. Select all of the
     text, and copy it to the clipboard.

4.   From Microsoft Outlook 8.03, select a Public Folder that
     contains the messages to be filtered. You have Owner permissions
     on this folder.

5.   Right-click on the folder, and choose Properties. Click the
     Agents tab.

6.   Create a new agent. Click the Edit button to edit its
     properties.

7.   Enable the checkboxes for the following events:
        [x] A new item is posted in this folder
        [x] An item is changed in this folder

8.   Click Edit Script. A blank script skeleton is shown.

9.   Select all of the text in the script. Paste the contents of
     the clipboard (AUTOCAT.TXT), replacing the previous script
     contents. Click OK and save the agent.

TESTING THE SAMPLE:

Send or post some messages which contain some of the keywords in
their message body and let the script process the messages. From
Outlook, verify that the messages now contain the proper entries
in the Keywords field. Create a Group by Keyword view in
Outlook, and make sure the all of the messages that are listed
under the correct keyword categories.

MODIFYING SEARCH KEYWORDS:

If you wish to change the keywords, they are stored as a global
array at the top of the script (g_SearchArray). If you add or
remove keywords, be sure to also change the g_NumOfKeywords and
g_MatchCnt variables to match the actual number of keywords.

OTHER SCRIPT IDEAS:

Search the message body for keywords and then move the message to
a special folder.
