PRB: Can't Get Appointment Properties With EventDetails.MessageID (243387)



The information in this article applies to:

  • Collaboration Data Objects (CDO) 1.2
  • Collaboration Data Objects (CDO) 1.21
  • Microsoft Exchange Server 5.5

This article was previously published under Q243387

SYMPTOMS

When you install an event script on a Calendar folder to process appointments, AppointmentItem-specific properties such as Location, StartTime, and EndTime can not be retrieved. Attempting to do this results a VBScript runtime error:
'800a01b6' "Object doesn't support this property or method"

CAUSE

EventDetails.MessageID returns the EntryID of a Message object instead of an AppointmentItem object.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Install the following script to the default Calendar folder of a mailbox for the event "A new item is posted to this folder."Add a new appointment to the calendar folder to trigger the script.Check the Agent log for the results. Note that the oMsg.Class is three (for a Message object) rather than 26, for an AppointmentItem. Uncomment the line in the script to retrieve oMsg.Location. Add another new appointment to the calendar to trigger the script. Check the Agent log for the results. Note that a VBScript runtime error 800a01b6 occurs at oMsg.Location.
    <SCRIPT RunAt=Server Language=VBScript>
    Option Explicit 
    Dim g_bstrDebug	' Debug String
    
    ' DESCRIPTION: Fired when a new message is added to the folder
    Public Sub Folder_OnMessageCreated
    	Dim oMsg
    	Dim CDOPR_ENTRYID
    
    	Call DebugAppend("Calendar -- Folder_OnMessageCreated", False)
                
    	Set oMsg = _
    	    EventDetails.Session.GetMessage(EventDetails.MessageID, Null)
    
    	Call DebugAppend("MessageClass: " & oMsg.Class, False)
             Call DebugAppend("MessageSubject: " & oMsg.Subject, False)
    	'Call DebugAppend("MessageLocation: " & oMsg.Location, False)
    
    	' Check for possible sys errors
    	Call DebugAppend("Error Detected: ", True)
    	
    	Script.Response = g_bstrDebug
    End Sub
    
    
    '---------------------------------------------------------------------'
    '   Name: DebugAppend
    '   Area: Debug
    '   Desc: Simple Debugging Function
    '   Parm: String Text, Bool ErrorFlag
    '---------------------------------------------------------------------'
    Private Sub DebugAppend(bstrParm,boolErrChkFlag)
           If boolErrChkFlag = True Then
              If err.number <> 0 Then
                 g_bstrDebug = g_bstrDebug & bstrParm & "-" & _
                               cstr(err.number) & err.description & vbCrLf
                 err.clear
              End If
           Else
              g_bstrDebug = g_bstrDebug & bstrParm & vbCrLf
           End If
    End Sub
    
    </SCRIPT>
    						
  2. Add a new appointment to the calendar folder to trigger the script.Check the Agent log for the results. Note that the oMsg.Class is three (for a Message object) rather than 26, for an AppointmentItem. Uncomment the line in the script to retrieve oMsg.Location. Add another new appointment to the calendar to trigger the script. Check the Agent log for the results. Note that a VBScript runtime error 800a01b6 occurs at oMsg.Location.
    <SCRIPT RunAt=Server Language=VBScript>
    Option Explicit 
    Dim g_bstrDebug	' Debug String
    
    ' DESCRIPTION: Fired when a new message is added to the folder
    Public Sub Folder_OnMessageCreated
    	Dim oMsg
    	Dim CDOPR_ENTRYID
    
    	Call DebugAppend("Calendar -- Folder_OnMessageCreated", False)
                
    	Set oMsg = _
    	    EventDetails.Session.GetMessage(EventDetails.MessageID, Null)
    
    	Call DebugAppend("MessageClass: " & oMsg.Class, False)
             Call DebugAppend("MessageSubject: " & oMsg.Subject, False)
    	'Call DebugAppend("MessageLocation: " & oMsg.Location, False)
    
    	' Check for possible sys errors
    	Call DebugAppend("Error Detected: ", True)
    	
    	Script.Response = g_bstrDebug
    End Sub
    
    
    '---------------------------------------------------------------------'
    '   Name: DebugAppend
    '   Area: Debug
    '   Desc: Simple Debugging Function
    '   Parm: String Text, Bool ErrorFlag
    '---------------------------------------------------------------------'
    Private Sub DebugAppend(bstrParm,boolErrChkFlag)
           If boolErrChkFlag = True Then
              If err.number <> 0 Then
                 g_bstrDebug = g_bstrDebug & bstrParm & "-" & _
                               cstr(err.number) & err.description & vbCrLf
                 err.clear
              End If
           Else
              g_bstrDebug = g_bstrDebug & bstrParm & vbCrLf
           End If
    End Sub
    
    </SCRIPT>
    						
  3. Check the Agent log for the results. Note that the oMsg.Class is three (for a Message object) rather than 26, for an AppointmentItem. Uncomment the line in the script to retrieve oMsg.Location. Add another new appointment to the calendar to trigger the script. Check the Agent log for the results. Note that a VBScript runtime error 800a01b6 occurs at oMsg.Location.
    <SCRIPT RunAt=Server Language=VBScript>
    Option Explicit 
    Dim g_bstrDebug	' Debug String
    
    ' DESCRIPTION: Fired when a new message is added to the folder
    Public Sub Folder_OnMessageCreated
    	Dim oMsg
    	Dim CDOPR_ENTRYID
    
    	Call DebugAppend("Calendar -- Folder_OnMessageCreated", False)
                
    	Set oMsg = _
    	    EventDetails.Session.GetMessage(EventDetails.MessageID, Null)
    
    	Call DebugAppend("MessageClass: " & oMsg.Class, False)
             Call DebugAppend("MessageSubject: " & oMsg.Subject, False)
    	'Call DebugAppend("MessageLocation: " & oMsg.Location, False)
    
    	' Check for possible sys errors
    	Call DebugAppend("Error Detected: ", True)
    	
    	Script.Response = g_bstrDebug
    End Sub
    
    
    '---------------------------------------------------------------------'
    '   Name: DebugAppend
    '   Area: Debug
    '   Desc: Simple Debugging Function
    '   Parm: String Text, Bool ErrorFlag
    '---------------------------------------------------------------------'
    Private Sub DebugAppend(bstrParm,boolErrChkFlag)
           If boolErrChkFlag = True Then
              If err.number <> 0 Then
                 g_bstrDebug = g_bstrDebug & bstrParm & "-" & _
                               cstr(err.number) & err.description & vbCrLf
                 err.clear
              End If
           Else
              g_bstrDebug = g_bstrDebug & bstrParm & vbCrLf
           End If
    End Sub
    
    </SCRIPT>
    						
  4. Uncomment the line in the script to retrieve oMsg.Location. Add another new appointment to the calendar to trigger the script. Check the Agent log for the results. Note that a VBScript runtime error 800a01b6 occurs at oMsg.Location.
    <SCRIPT RunAt=Server Language=VBScript>
    Option Explicit 
    Dim g_bstrDebug	' Debug String
    
    ' DESCRIPTION: Fired when a new message is added to the folder
    Public Sub Folder_OnMessageCreated
    	Dim oMsg
    	Dim CDOPR_ENTRYID
    
    	Call DebugAppend("Calendar -- Folder_OnMessageCreated", False)
                
    	Set oMsg = _
    	    EventDetails.Session.GetMessage(EventDetails.MessageID, Null)
    
    	Call DebugAppend("MessageClass: " & oMsg.Class, False)
             Call DebugAppend("MessageSubject: " & oMsg.Subject, False)
    	'Call DebugAppend("MessageLocation: " & oMsg.Location, False)
    
    	' Check for possible sys errors
    	Call DebugAppend("Error Detected: ", True)
    	
    	Script.Response = g_bstrDebug
    End Sub
    
    
    '---------------------------------------------------------------------'
    '   Name: DebugAppend
    '   Area: Debug
    '   Desc: Simple Debugging Function
    '   Parm: String Text, Bool ErrorFlag
    '---------------------------------------------------------------------'
    Private Sub DebugAppend(bstrParm,boolErrChkFlag)
           If boolErrChkFlag = True Then
              If err.number <> 0 Then
                 g_bstrDebug = g_bstrDebug & bstrParm & "-" & _
                               cstr(err.number) & err.description & vbCrLf
                 err.clear
              End If
           Else
              g_bstrDebug = g_bstrDebug & bstrParm & vbCrLf
           End If
    End Sub
    
    </SCRIPT>
    						
  5. Add another new appointment to the calendar to trigger the script. Check the Agent log for the results. Note that a VBScript runtime error 800a01b6 occurs at oMsg.Location.
    <SCRIPT RunAt=Server Language=VBScript>
    Option Explicit 
    Dim g_bstrDebug	' Debug String
    
    ' DESCRIPTION: Fired when a new message is added to the folder
    Public Sub Folder_OnMessageCreated
    	Dim oMsg
    	Dim CDOPR_ENTRYID
    
    	Call DebugAppend("Calendar -- Folder_OnMessageCreated", False)
                
    	Set oMsg = _
    	    EventDetails.Session.GetMessage(EventDetails.MessageID, Null)
    
    	Call DebugAppend("MessageClass: " & oMsg.Class, False)
             Call DebugAppend("MessageSubject: " & oMsg.Subject, False)
    	'Call DebugAppend("MessageLocation: " & oMsg.Location, False)
    
    	' Check for possible sys errors
    	Call DebugAppend("Error Detected: ", True)
    	
    	Script.Response = g_bstrDebug
    End Sub
    
    
    '---------------------------------------------------------------------'
    '   Name: DebugAppend
    '   Area: Debug
    '   Desc: Simple Debugging Function
    '   Parm: String Text, Bool ErrorFlag
    '---------------------------------------------------------------------'
    Private Sub DebugAppend(bstrParm,boolErrChkFlag)
           If boolErrChkFlag = True Then
              If err.number <> 0 Then
                 g_bstrDebug = g_bstrDebug & bstrParm & "-" & _
                               cstr(err.number) & err.description & vbCrLf
                 err.clear
              End If
           Else
              g_bstrDebug = g_bstrDebug & bstrParm & vbCrLf
           End If
    End Sub
    
    </SCRIPT>
    						
  6. Check the Agent log for the results. Note that a VBScript runtime error 800a01b6 occurs at oMsg.Location.
    <SCRIPT RunAt=Server Language=VBScript>
    Option Explicit 
    Dim g_bstrDebug	' Debug String
    
    ' DESCRIPTION: Fired when a new message is added to the folder
    Public Sub Folder_OnMessageCreated
    	Dim oMsg
    	Dim CDOPR_ENTRYID
    
    	Call DebugAppend("Calendar -- Folder_OnMessageCreated", False)
                
    	Set oMsg = _
    	    EventDetails.Session.GetMessage(EventDetails.MessageID, Null)
    
    	Call DebugAppend("MessageClass: " & oMsg.Class, False)
             Call DebugAppend("MessageSubject: " & oMsg.Subject, False)
    	'Call DebugAppend("MessageLocation: " & oMsg.Location, False)
    
    	' Check for possible sys errors
    	Call DebugAppend("Error Detected: ", True)
    	
    	Script.Response = g_bstrDebug
    End Sub
    
    
    '---------------------------------------------------------------------'
    '   Name: DebugAppend
    '   Area: Debug
    '   Desc: Simple Debugging Function
    '   Parm: String Text, Bool ErrorFlag
    '---------------------------------------------------------------------'
    Private Sub DebugAppend(bstrParm,boolErrChkFlag)
           If boolErrChkFlag = True Then
              If err.number <> 0 Then
                 g_bstrDebug = g_bstrDebug & bstrParm & "-" & _
                               cstr(err.number) & err.description & vbCrLf
                 err.clear
              End If
           Else
              g_bstrDebug = g_bstrDebug & bstrParm & vbCrLf
           End If
    End Sub
    
    </SCRIPT>
    						

Modification Type:MinorLast Reviewed:3/4/2004
Keywords:kbMsg kbprb KB243387