R
rfalken
Hello folks,
Any idea why the if statement in this code snippet doesn't work? If
remove the if statement it works. This is a cut down version of th
code from CDOLive....
' DESCRIPTION: This event is fired when a new message is added to th
folder
Public Sub Folder_OnMessageCreated
Dim oSession ' Session
Dim oCurrentMsg ' Current message
Dim oFolder ' Current folder
Dim NewMC ' New message type
' Clear error buffer
Err.Clear
' Get session informationen
Set oSession = EventDetails.Session
' Write some logging
Call DebugAppend(oSession.CurrentUser & " ChgMsgCl - Proccessin
started", False)
' Get current folder
Set oFolder = oSession.GetFolder(EventDetails.FolderID,Null)
' Get current message
Set oCurrentMsg = oSession.GetMessage(EventDetails.MessageID,Null)
' Set current message to read
oCurrentMsg.Unread = False
' Remember subject of arrived message
Call DebugAppend("New message with subject: <" & oCurrentMsg.Subject
"> arrived", False)
NewMC = "IPM.Note"
If oCurrentMsg.Type = NewMC Then
' Change the Message Class
Call DebugAppend("Message Type : <" & oCurrentMsg.Type & "> "
False)
oCurrentMsg.Type = "IPM.Note.NewSalesForm"
' Save the changed item
oCurrentMsg.Update
Call DebugAppend("Updated Message Type : <" & oCurrentMsg.Type & "> "
False)
'End If
' Release objects
Set oSession = Nothing
Set oCurrentMsg = Nothing
Set oFolder = Nothing
' Write results in the Scripting Agent log
Script.Response = g_bstrDebug
End Sub
' DESCRIPTION: This event is fired when a message in the folder i
changed
Public Sub Message_OnChange
'Not used
End Sub
' DESCRIPTION: This event is fired when a message is deleted from th
folder
Public Sub Folder_OnMessageDeleted
'Not used
End Sub
' DESCRIPTION: This event is fired when the timer on the folde
expires
Public Sub Folder_OnTimer
'Not used
End Su
Any idea why the if statement in this code snippet doesn't work? If
remove the if statement it works. This is a cut down version of th
code from CDOLive....
' DESCRIPTION: This event is fired when a new message is added to th
folder
Public Sub Folder_OnMessageCreated
Dim oSession ' Session
Dim oCurrentMsg ' Current message
Dim oFolder ' Current folder
Dim NewMC ' New message type
' Clear error buffer
Err.Clear
' Get session informationen
Set oSession = EventDetails.Session
' Write some logging
Call DebugAppend(oSession.CurrentUser & " ChgMsgCl - Proccessin
started", False)
' Get current folder
Set oFolder = oSession.GetFolder(EventDetails.FolderID,Null)
' Get current message
Set oCurrentMsg = oSession.GetMessage(EventDetails.MessageID,Null)
' Set current message to read
oCurrentMsg.Unread = False
' Remember subject of arrived message
Call DebugAppend("New message with subject: <" & oCurrentMsg.Subject
"> arrived", False)
NewMC = "IPM.Note"
If oCurrentMsg.Type = NewMC Then
' Change the Message Class
Call DebugAppend("Message Type : <" & oCurrentMsg.Type & "> "
False)
oCurrentMsg.Type = "IPM.Note.NewSalesForm"
' Save the changed item
oCurrentMsg.Update
Call DebugAppend("Updated Message Type : <" & oCurrentMsg.Type & "> "
False)
'End If
' Release objects
Set oSession = Nothing
Set oCurrentMsg = Nothing
Set oFolder = Nothing
' Write results in the Scripting Agent log
Script.Response = g_bstrDebug
End Sub
' DESCRIPTION: This event is fired when a message in the folder i
changed
Public Sub Message_OnChange
'Not used
End Sub
' DESCRIPTION: This event is fired when a message is deleted from th
folder
Public Sub Folder_OnMessageDeleted
'Not used
End Sub
' DESCRIPTION: This event is fired when the timer on the folde
expires
Public Sub Folder_OnTimer
'Not used
End Su