Guest_imported
New member
- Jan 1, 1970
- 0
Can someone tell me what's wrong with this function!
I really don't see it.
I get an error on the line "Set oField = oRecip.AddressEntry.Fields(CdoPR_EMS_AB_PROXY_ADDRESSES)"
Can anyone please help me!
This is the whole source of the script.
HELP!!HELP!!HELP!!HELP!!HELP!!HELP!!HELP!!HELP!!HELP!!
<SCRIPT RunAt=Server Language=VBScript>
Option Explicit
Dim iRuleCount
iRuleCount = 0
Dim Rules(0)
'Filling in rules array
Rules(0) = Array(4,"email@address.com", 1,"000000001A447390AA6611CD9BC800AA002FC45A030062625C45E457D311999600A0C9FC4F190000000714A60000"
Const CdoPR_EMS_AB_PROXY_ADDRESSES = &H800F101E
'
' Global variables
'
Dim oMsg ' Message Object
Dim CDOSession ' Session Object
Dim oFolder ' Current Folder Object
Dim bDebug ' Debug turned off or on
bDebug = False
'
' DESCRIPTION: This event is fired when a message in the folder is created
'
Public Sub Folder_OnMessageCreated
Dim i ' Cycle variable
WriteDebugString "Message created"
Set CDOSession = EventDetails.Session ' get CDO session from
Set oMsg = CDOSession.GetMessage(EventDetails.MessageID,Null)
Set oFolder = CDOSession.GetFolder(EventDetails.FolderID, Null )
WriteDebugString "Message object received"
If Err.Number = 0 Then
For i=0 To iRuleCount
If Rules(i)(0) = 1 Then ' Sender name is
If oMsg.Sender.Name = Rules(i)(1) Then
PerformAction Rules(i)(2),Rules(i)(3)
End If
ElseIf Rules(i)(0) = 2 Then ' Receiver name is
If IsInRecipients(Rules(i)(1),1) Then
PerformAction Rules(i)(2),Rules(i)(3)
End If
ElseIf Rules(i)(0) = 3 Then ' Sender e-mail is
If oMsg.Sender.Address = Rules(i)(1) Then
PerformAction Rules(i)(2),Rules(i)(3)
End If
ElseIf Rules(i)(0) = 4 Then ' Receiver e-mail is
If IsInRecipients(Rules(i)(1),2) Then
PerformAction Rules(i)(2),Rules(i)(3)
End If
End If
Next
End If
Set oMsg = Nothing
Set oFolder = Nothing
Set CDOSession = Nothing
End Sub
'
' This is util procedure to perform specific action
'
Sub PerformAction(ActionType, FolderId)
If ActionType = 1 Then
oMsg.MoveTo(FolderId)
ElseIf ActionType = 2 Then
Dim oCopiedMessage
Set oCopiedMessage = oMsg.CopyTo(FolderId)
oCopiedMessage.Update
Set oCopiedMessage = Nothing
ElseIf ActionType = 3 Then
oMsg.Delete
End If
End Sub
'
' Checks if needed name is amoung recipients
'
' CheckParam - parameter to check
' 1 = Name
' 2 = Mail Address
'
Function IsInRecipients(Data, CheckParam)
Dim i
Dim oRecip
Dim oField
Dim v
Dim str
For i = 1 To oMsg.Recipients.Count
Set oRecip = oMsg.Recipients.Item(i)
If CheckParam = 1 Then
If LCase(oRecip.Name) = LCase(Data) Then
WriteDebugString "Name matches"
Set oRecip = Nothing
IsInRecipients = True
Exit Function
End If
ElseIf CheckParam = 2 Then
Set oField = oRecip.AddressEntry.Fields(CdoPR_EMS_AB_PROXY_ADDRESSES)
' This line gives me an error
For Each v In oField.Value
If LCase(Right(v, Len(v)-InStr(v,":"
)) = LCase(Data) Then
WriteDebugString "E-Mail address matches"
Set oField = Nothing
Set oRecip = Nothing
IsInRecipients = True
Exit Function
End If
Next
Set oField = Nothing
End If
Set oRecip = Nothing
Next
IsInRecipients = False
End Function
'
' This outputs debug string
'
Sub WriteDebugString(str)
If bDebug Then
Script.Response = Script.Response & str & vbCrLf
End If
End Sub
' DESCRIPTION: This event is fired when a message in the folder is changed
Public Sub Message_OnChange
End Sub
' DESCRIPTION: This event is fired when a message is deleted from the folder
Public Sub Folder_OnMessageDeleted
End Sub
' DESCRIPTION: This event is fired when the timer on the folder expires
Public Sub Folder_OnTimer
End Sub
</SCRIPT>
I really don't see it.
I get an error on the line "Set oField = oRecip.AddressEntry.Fields(CdoPR_EMS_AB_PROXY_ADDRESSES)"
Can anyone please help me!
This is the whole source of the script.
HELP!!HELP!!HELP!!HELP!!HELP!!HELP!!HELP!!HELP!!HELP!!
<SCRIPT RunAt=Server Language=VBScript>
Option Explicit
Dim iRuleCount
iRuleCount = 0
Dim Rules(0)
'Filling in rules array
Rules(0) = Array(4,"email@address.com", 1,"000000001A447390AA6611CD9BC800AA002FC45A030062625C45E457D311999600A0C9FC4F190000000714A60000"
Const CdoPR_EMS_AB_PROXY_ADDRESSES = &H800F101E
'
' Global variables
'
Dim oMsg ' Message Object
Dim CDOSession ' Session Object
Dim oFolder ' Current Folder Object
Dim bDebug ' Debug turned off or on
bDebug = False
'
' DESCRIPTION: This event is fired when a message in the folder is created
'
Public Sub Folder_OnMessageCreated
Dim i ' Cycle variable
WriteDebugString "Message created"
Set CDOSession = EventDetails.Session ' get CDO session from
Set oMsg = CDOSession.GetMessage(EventDetails.MessageID,Null)
Set oFolder = CDOSession.GetFolder(EventDetails.FolderID, Null )
WriteDebugString "Message object received"
If Err.Number = 0 Then
For i=0 To iRuleCount
If Rules(i)(0) = 1 Then ' Sender name is
If oMsg.Sender.Name = Rules(i)(1) Then
PerformAction Rules(i)(2),Rules(i)(3)
End If
ElseIf Rules(i)(0) = 2 Then ' Receiver name is
If IsInRecipients(Rules(i)(1),1) Then
PerformAction Rules(i)(2),Rules(i)(3)
End If
ElseIf Rules(i)(0) = 3 Then ' Sender e-mail is
If oMsg.Sender.Address = Rules(i)(1) Then
PerformAction Rules(i)(2),Rules(i)(3)
End If
ElseIf Rules(i)(0) = 4 Then ' Receiver e-mail is
If IsInRecipients(Rules(i)(1),2) Then
PerformAction Rules(i)(2),Rules(i)(3)
End If
End If
Next
End If
Set oMsg = Nothing
Set oFolder = Nothing
Set CDOSession = Nothing
End Sub
'
' This is util procedure to perform specific action
'
Sub PerformAction(ActionType, FolderId)
If ActionType = 1 Then
oMsg.MoveTo(FolderId)
ElseIf ActionType = 2 Then
Dim oCopiedMessage
Set oCopiedMessage = oMsg.CopyTo(FolderId)
oCopiedMessage.Update
Set oCopiedMessage = Nothing
ElseIf ActionType = 3 Then
oMsg.Delete
End If
End Sub
'
' Checks if needed name is amoung recipients
'
' CheckParam - parameter to check
' 1 = Name
' 2 = Mail Address
'
Function IsInRecipients(Data, CheckParam)
Dim i
Dim oRecip
Dim oField
Dim v
Dim str
For i = 1 To oMsg.Recipients.Count
Set oRecip = oMsg.Recipients.Item(i)
If CheckParam = 1 Then
If LCase(oRecip.Name) = LCase(Data) Then
WriteDebugString "Name matches"
Set oRecip = Nothing
IsInRecipients = True
Exit Function
End If
ElseIf CheckParam = 2 Then
Set oField = oRecip.AddressEntry.Fields(CdoPR_EMS_AB_PROXY_ADDRESSES)
' This line gives me an error
For Each v In oField.Value
If LCase(Right(v, Len(v)-InStr(v,":"
WriteDebugString "E-Mail address matches"
Set oField = Nothing
Set oRecip = Nothing
IsInRecipients = True
Exit Function
End If
Next
Set oField = Nothing
End If
Set oRecip = Nothing
Next
IsInRecipients = False
End Function
'
' This outputs debug string
'
Sub WriteDebugString(str)
If bDebug Then
Script.Response = Script.Response & str & vbCrLf
End If
End Sub
' DESCRIPTION: This event is fired when a message in the folder is changed
Public Sub Message_OnChange
End Sub
' DESCRIPTION: This event is fired when a message is deleted from the folder
Public Sub Folder_OnMessageDeleted
End Sub
' DESCRIPTION: This event is fired when the timer on the folder expires
Public Sub Folder_OnTimer
End Sub
</SCRIPT>