As it turns out, the WinNT provider doesn't expose this attibute. It shows as valid in the debugger but you'll never get the value. You'll have to switch to the LDAP provider, that's actually recommended because the WinNT provider is pretty much used just for legacy support and it doesn't include many new features of Active Directory. Here is a sample code for getting emails with the LDAP provider, with this code I do get the Email field from the General tab. You'll have to use LDAP path and navigate down to either a group (cn=users) or an Organizational Unit (OU=Sales).
Dim ADGroup As Object
Dim ADUser As Object
Dim Email As String
On Error GoTo ErrorHandler
Set ADGroup = GetObject("LDAP://cn=users,dc=ddcsoftware,dc=com")
On Error Resume Next
For Each ADUser In ADGroup
If ADUser.Class = "user" Then
Email = ""
Email = ADUser.EmailAddress
Debug.Print ADUser.FullName & ": " & Email
End If
Next
Exit Sub
ErrorHandler:
MsgBox Err.Description
>Hi Roman,
>I tried it. It is not working it gives me blank email id even if it is there in the active Directory. I think the email address should be there when I open Active directory and the Properties of a user, it should be there in the E-mail in General tab right? It is there but it is not picking up. What could be the reason?
>Regards,
>Suvi Joseph
Roman Rehak, MCSD, MCDBA, MCSA
Competitive Computing
354 Mountain View Drive
Colchester, VT 05446-5824
802-764-1729