Accessing user defined field in Contact

Joined
May 13, 2011
Messages
1
Reaction score
0
Hi,

I'm reasonably new to Outlook coding so apologies if I don't explain this problem very well.

My company has included a number of custom fields to employee contacts in the GAL (emp ID, grade, division etc). As part of a user form, I want to be able to bring up the GAL, select the required employee contact and then have a specific custom field (emp ID) brought back.

I was able to achieve this using CDO 1.21, however this only works on 50% of machines for some reason, and I have since found out it's a discontinued technology anyway. So I want to recreate it using the Object model instead.

I got as far as the code below;

Code:
Private Sub CommandButton2_Click()
 Dim oDialog As SelectNamesDialog
    Dim oAL As AddressList
    Dim oContacts As Folder
    Dim Employee As Object
    Dim EmpID As String
 
    Set oDialog = Application.Session.GetSelectNamesDialog
      With oDialog
        'Initialize the dialog box with the address list representing the Contacts folder
        .InitialAddressList = oAL
        .ShowOnlyInitialAddressList = True
        If .Display Then
            'Recipients Resolved
            'Access Recipients using oDialog.Recipients
        Set Employee = oDialog.Recipients.Item(1)

I can't work out though how to access the custom fields. In CDO i could access it via the below method:

Code:
empnovalue = Recipients.Item(1).AddressEntry.Fields(31)

However the object model doesn't appear to have the 'Fields' option under 'AddressEntry'.

Can someone please help??
 

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