How can I read ldap custom extension fields? RRS feed

  • Question

  • User417135343 posted

     I am using ASP.Net Framework 1.1 and VB to connect to ldap, query and read field values. I am using ADODB.Command and ADODB.connection classes to execute the query. 

    Dim Conn As New ADODB.Connection
    Conn = CreateObject("ADODB.Connection")
    Conn.Provider = "ADsDSOObject"
    Conn.Open("ADs Provider", UserID, Password)
    Dim com As ADODB.Command
    com = CreateObject("ADODB.Command")
    com.ActiveConnection = Conn
    com.CommandText = "<LDAP://server/ou=0,o=company>;" & _
           "(uid=" & strUserID & ");cn,sn,z-nickname;subtree"

    Dim RS As ADODB.Recordset
    RS = com.Execute

    I was able to read regular fields like cn, sn, gienname etc but not the custom extension fields that we added to ldap records, something like z-nickname, z-country. I am getting an Unspecified Error when I try to retrieve the z-nickname field.

    Is it possible to read these custom extension fields using ADODB and if so what should be the commandText?

    Sunday, April 12, 2009 3:00 AM

All replies

  • User1191518856 posted

    As far as I know, there should be no limitation on the attributes you may query using this technique. The syntax you're using is perfectly valid.

    Maybe the error you get is related to the syntax you use when you're trying to *read* the value? (I assume you don't get the error when you do Execute).

    What datatype is z-nickname? Can you provide the code you're using to access this data?

    Monday, April 13, 2009 5:43 PM