Trouble retrieving address book / contacts from Active Directory

letdown427

Golden Member
Jan 3, 2006
1,594
1
0
Basically, I'm to write an application for logging technical support calls / issues etc. and would like to use the existing customer contacts database to log who called in etc.

I've been informed that LDAP is how I should be retrieving this information. All of our contacts are stored in a public folder called customers, and although I can find this fine using various bits of sample code etc, I can't see how to actually get the information that's in it.

Have I just completely misunderstood how Active Directory works?

I'm writing this in VB .Net, so ideally any code in VB would be appreciated :)

Most of the samples I've found seem to be about looking up User information from Active Directory, I can't seem ot find anything about simply looking up / reading out contacts...

Many thanks,

James



Edit:

Having had a bit more of a look around, is CDO a better option? Whatever that is of course.

Edit2:

Outlook Object Model looks to be ideal for the sort of things I want to do, I've settled on using this.

Outlook Object Model Overview
 

KB

Diamond Member
Nov 8, 1999
5,406
389
126
What seems to be the issue? Post some code you are using. It is fairly easy once you get started.


'get the customer ou and loop through all customers displaying their name: fill in your LDAP info
Dim customersOU As DirectoryEntry = New DirectoryEntry("LDAP://domain.com/OU=Customers,DC=DC=Domain,DC=com")
For Each user As DirectoryEntry In customersOU.Children
If user.SchemaClassName = "user" Then Msgbox("Heres a customer: " & user.Properties("displayName").Value)
Next
 

letdown427

Golden Member
Jan 3, 2006
1,594
1
0
In your example, you put the OU as customers. That gives me an Object doesn't exist on server error.

It seems to get anything about this 'customers' folder I have to use CN=customers,CN=Microsoft Exchange System Objects,DC=domain etc....

I presume the fact this is coming up as CN instead of OU is pretty relevant? Unfortunately, not having much knowledge about the various abbreviations, I'm not sure why as such...

Thanks