Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Active directory

Status
Not open for further replies.

BobBob10

Programmer
Apr 24, 2005
57
GB
The example below returns the full name from Active directory. How do I return other information such as email address etc?

Code:
Dim dsDirectoryEntry As DirectoryEntry

strPath = "WinNT://" & strDomain & "/" & strLogin
dsDirectoryEntry = New DirectoryEntry(strPath)
strFullName = CType(dsDirectoryEntry.Invoke("Get", "FullName"), String)
[\code]
 
I've only done a few queries like this, but it's my understanding that everything matches the label in the AD Users & Computers tool.

If this holds true, then to get e-mail, your code would change to

.....
strEMail = CType(dsDirectoryEntry.Invoke("Get", "EMail"), String)

I don't have an AD available to me atm to test on, so let me know if this works :)
 
OK...I just looked through my old code and the parameter is Mail...not EMail

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top