Outlook Contacts Mobile Phone Number

B

Ben Crinion

Hi,

I am trying to retrieve a comtacts mobile phone number from the
contacts folder.

The following VB6 code accesses the correct folder and retrieves
contacts but it doesnt display the phone number. When i "watch" the
row(1) variable it contains the following value "Error -2147221233".

If i use the same hex value to access a property in the Global Address
List it returns the number as expected.

I have used Outlook Spy to inspect the contacts and the mobile phone
numbers are present and im using the correct value for the property so
i dont know whats going on.

Anyone got any clues?

'table dims
Dim Columns(1)
Dim Row
Dim Filter 'As Redemption.TableFilter
Dim Restr 'As Redemption.RestrictionProperty
Dim Table 'As Redemption.MAPITable

'address dims
Dim session As session
Dim objAddressList 'As Redemption.AddressList
Dim objAddressEntries 'As Redemption.AddressEntries

Set Table = CreateObject("TBOLcom.MAPITable")
Table.Item =
Application.session.AddressLists.Item("Contacts").AddressEntries

'hex values for the properties i need
PR_DISPLAY_NAME = &H3001001E
PR_MOBILE_PHONE_NO = &H3A1C001E

Columns(0) = PR_DISPLAY_NAME
Columns(1) = PR_MOBILE_PHONE_NO

Table.Columns = Columns
Table.GoToFirst
Do
Row = Table.GetRow
If Not IsEmpty(Row) Then
On Error Resume Next
Debug.Print (Row(0) & vbTab & Row(1))
End If
Loop Until IsEmpty(Row)

End Function

Thanks,
Ben Crinion
 
S

Sue Mosher [MVP-Outlook]

Outlook contact address entries don't expose such details. You need to
access the actual ContactItem to get a mobile number.
 
B

Ben Crinion

Does this mean that I shouldnt use MAPI Tables?

The code I quoted is almost an exact copy of the code from the Redemption
site.
 
S

Sue Mosher [MVP-Outlook]

Repeating: Outlook contact address entries don't expose such details. Look
at your statement:

Table.Item =
Application.session.AddressLists.Item("Contacts").AddressEntries

Your MAPITable is looking at the AddressEntries collection. The mobile
number is in the Contacts folder items, not in an address entry. Maybe you
should be building your MAPITable from the folder.Items.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top