Microsoft KB Archive/246516

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 12:49, 21 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


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

Article ID: 246516

Article Last Modified on 6/29/2004



APPLIES TO

  • Microsoft Exchange Server 5.5 Standard Edition
  • Microsoft Collaboration Data Objects 1.2
  • Microsoft Collaboration Data Objects 1.21



This article was previously published under Q246516

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.

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>
                

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


Keywords: kbhowto kbmsg KB246516