get all the contact names from address books

Hi,

Could anyone please tell me whow could I get the all person's names from address book and display it in combobox in Add-in form,?

Thanks.
LVL 1
deshawAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
David LeeConnect With a Mentor Commented:
Use the code from this question http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_24280084.html with a couple of slight modifications.  

1.  First, change the SELECT statement on line 5 so the command retrieves all users not just the one with the account name 'jdoe'.
2.  Remove line 12 and replace it with commands to populate your pulldown control
Sub GetContactInfo()
    Set rsDetails = Wscript.CreateObject("ADODB.Recordset")
    rsDetails.ActiveConnection = "Provider=ADSDSOObject"
    'Replace DomainName on the following line with the name of your domain and jdoe with the account name you want to search for'
    rsDetails.Source = "SELECT ADsPath, displayName, Company, Department, Division FROM 'LDAP://DomainName' WHERE objectClass='user' AND objectCategory='Person'"
    rsDetails.CursorType = 0
    rsDetails.CursorLocation = 2
    rsDetails.LockType = 1
    rsDetails.Open()
    If Not rsDetails.EOF Then
        With rsDetails
            'Commands to populate your controls go here'
        End With
    End If
    rsDetails.Close
    Set rsDetails = Nothing
End Sub

Open in new window

0
 
David LeeCommented:
Hi, deshaw.

Which address book?
0
 
deshawAuthor Commented:
From Global Address List.
Thanks.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
deshawAuthor Commented:
basically i need the list of users in attached dialog.  i think you got it now.
allusers.JPG
0
 
deshawAuthor Commented:
thanks so simple. :)
0
 
David LeeCommented:
You're welcome.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.