Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How To Access Categories (Keywords) Field From an Event Script


View products that this article applies to.

This article was previously published under Q246516

↑ Back to the top


Summary

This article contains a code sample that demonstrates how to programmatically access the contents of a Message object's Categories field from within an Exchange Server Event Script.

↑ Back to the top


More information

The following Microsoft Visual Basic Scripting (VBScript) code is assumed to be installed on a folder on Microsoft Exchange Server 5.5 computer.
<SCRIPT RunAt=Server Language=VBScript>

Option Explicit

'This event is fired when a new message is added to the folder
Public Sub Folder_OnMessageCreated()
   Dim objMessage
   Set objMessage = EventDetails.Session.GetMessage(EventDetails.MessageID)
   Dim strCategories
   If TypeName(objMessage.Categories) = "Empty" Then
      strCategories = "No Categories!"
   Else
      strCategories = _
         "LBound:" & LBound(objMessage.Categories) & vbCrLf & _
         "UBound:" & UBound(objMessage.Categories) & vbCrLf & vbCrLf
      'Enumerating Categories in source message
      strCategories = strCategories & _
                      "Enumerating Categories in source message" & _
                      vbCrLf & vbCrLf
      Dim vCat
      Dim v
      vCat = objMessage.Categories
      For Each v In vCat
         strCategories = strCategories & v & vbCrLf
      Next
   End If
   Script.Response = strCategories
End Sub

</SCRIPT>
				

↑ Back to the top


References

See the following article to get information on how to programmatically access the contents of keywords fields (for example, categories, companies, and children fields) in Microsoft Outlook using VBScript:
201099� OL2000: Working with Keywords Fields from VBScript

↑ Back to the top


Keywords: KB246516, kbmsg, kbhowto

↑ Back to the top

Article Info
Article ID : 246516
Revision : 5
Created on : 6/29/2004
Published on : 6/29/2004
Exists online : False
Views : 468