M
Mats-Lennart Hansson
I'm using the redemption object. When a new mail arrives, I want to extract
the phone nr from the sender. This is done by looking in the address lists
for this user.
Is there an easier way to do this? This will be a slow solution with large
address lists.
Thanks,
Mats-Lennart
My code:
Private Sub redUtils_NewMail(ByVal Item As Object)
Select Case Item.MessageClass
Case "IPM.Note"
gsMobNr = GetMobileNumber(Item)
Case Else
rTracing.TraceLog "Info", "redUtils_NewMail", "Non supported
message type."
End Select
End Sub
Private Function GetMobileNumber(ByRef olMailItem As Object) As String
On Error GoTo ErrHandler
Dim sAddress As String
Dim rSafeMailItem As New Redemption.SafeMailItem
Dim i As Integer, ii As Integer
rSafeMailItem.Item = olMailItem
sAddress = rSafeMailItem.SenderEmailAddress
For i = 0 To rAddressLists.Count
Set rAddressEntries = rAddressLists(i).AddressEntries
For ii = 0 To rAddressEntries.Count
If (UCase(rAddressEntries(ii).Address) = UCase(sAddress))
Then
GetMobileNumber = rAddressEntries(ii).Fields(&H3A1C001E)
Exit Function
End If
Next ii
Next i
Exit Function
ErrHandler:
GetMobileNumber = "Unknown"
End Function
the phone nr from the sender. This is done by looking in the address lists
for this user.
Is there an easier way to do this? This will be a slow solution with large
address lists.
Thanks,
Mats-Lennart
My code:
Private Sub redUtils_NewMail(ByVal Item As Object)
Select Case Item.MessageClass
Case "IPM.Note"
gsMobNr = GetMobileNumber(Item)
Case Else
rTracing.TraceLog "Info", "redUtils_NewMail", "Non supported
message type."
End Select
End Sub
Private Function GetMobileNumber(ByRef olMailItem As Object) As String
On Error GoTo ErrHandler
Dim sAddress As String
Dim rSafeMailItem As New Redemption.SafeMailItem
Dim i As Integer, ii As Integer
rSafeMailItem.Item = olMailItem
sAddress = rSafeMailItem.SenderEmailAddress
For i = 0 To rAddressLists.Count
Set rAddressEntries = rAddressLists(i).AddressEntries
For ii = 0 To rAddressEntries.Count
If (UCase(rAddressEntries(ii).Address) = UCase(sAddress))
Then
GetMobileNumber = rAddressEntries(ii).Fields(&H3A1C001E)
Exit Function
End If
Next ii
Next i
Exit Function
ErrHandler:
GetMobileNumber = "Unknown"
End Function