PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Program Addins
Extracting phone nr from mail recipient?
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Program Addins
Extracting phone nr from mail recipient?
![]() |
Extracting phone nr from mail recipient? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
With Redemption you could set up a MAPITable filter on each AddressEntries
collection to retrieve an AddressEntry from that collection. The filter would be based on the recipient name, which is the only type of AddressEntries filter you can use. However that would be pretty fast since you wouldn't need those nested loops. You could just check to see if each collection returned any results. See Dmitry's example for an AddressEntries filter on his Web site. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Mats-Lennart Hansson" <ap_skallen@hotmail.com> wrote in message news:uXF4SFdWEHA.4064@TK2MSFTNGP11.phx.gbl... > 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 > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

