Microsoft KB Archive/246516: Difference between revisions
From BetaArchive Wiki
m (Text replacement - "&" to "&") |
m (Text replacement - """ to """) |
||
Line 63: | Line 63: | ||
Set objMessage = EventDetails.Session.GetMessage(EventDetails.MessageID) | Set objMessage = EventDetails.Session.GetMessage(EventDetails.MessageID) | ||
Dim strCategories | Dim strCategories | ||
If TypeName(objMessage.Categories) = | If TypeName(objMessage.Categories) = "Empty" Then | ||
strCategories = | strCategories = "No Categories!" | ||
Else | Else | ||
strCategories = _ | strCategories = _ | ||
"LBound:" & LBound(objMessage.Categories) & vbCrLf & _ | |||
"UBound:" & UBound(objMessage.Categories) & vbCrLf & vbCrLf | |||
'Enumerating Categories in source message | 'Enumerating Categories in source message | ||
strCategories = strCategories & _ | strCategories = strCategories & _ | ||
"Enumerating Categories in source message" & _ | |||
vbCrLf & vbCrLf | vbCrLf & vbCrLf | ||
Dim vCat | Dim vCat |
Latest revision as of 13:49, 21 July 2020
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