locked
Showing hidden attributes of Active Directory Users RRS feed

  • Question

  • User2141896116 posted

    Hiii...

    I need to show some hidden attributes of active directory users such as employeeID, this attribute exists in AD schema but hidden.

    I also wonder how to add a new tab to AD user properties and customize it.

    any ideas might help.

    Tuesday, January 23, 2007 2:18 AM

All replies

  • User-508806111 posted

    Here is a sample code with comments to retrieve appropriate fields:

     

            Dim oroot As DirectoryEntry = New DirectoryEntry("LDAP://YOURACTIVEDIRECTORY", "USERNAME-ADMIN, "PASSWORD")
            Dim osearcher As DirectorySearcher = New DirectorySearcher(oroot)
            Dim oresult As SearchResultCollection
            Dim result As SearchResult
    
            osearcher.Filter = "(&(objectCategory=person))" ' search filter
            osearcher.PropertiesToLoad.Add("cn") ' username
            osearcher.PropertiesToLoad.Add("name") ' full name
            osearcher.PropertiesToLoad.Add("givenname") ' firstname
            osearcher.PropertiesToLoad.Add("sn") ' lastname
            osearcher.PropertiesToLoad.Add("mail") ' mail
            osearcher.PropertiesToLoad.Add("initials") ' initials
            osearcher.PropertiesToLoad.Add("ou") ' organizational unit
            osearcher.PropertiesToLoad.Add("userPrincipalName") ' login name
            osearcher.PropertiesToLoad.Add("distinguishedName") ' distinguised name
            oresult = osearcher.FindAll()
    
            For Each result In oresult
                If Not result.GetDirectoryEntry.Properties("sn").Value Is Nothing Then
                    ' writes specific values retrieved from above - this is just a sample.
                    response.write(result.GetDirectoryEntry.Properties("cn").Value & ":" & result.GetDirectoryEntry.Properties("userPrincipalName").Value)
                End If
            Next

     hope this helps.

    Jae.

    Tuesday, January 23, 2007 2:47 AM
  • User2141896116 posted

    Thanx Jae for your reply, but seems I didnt explain it right;

     on the property window of a certain user in the active directory, how can i show a hidden attribute such as employeeID? and if this requires adding a new tab to the propery window to place the additional attributes then how to add it?

     

    Thanks

    Tuesday, January 23, 2007 5:01 AM