Hi All,
Basically I have been destroying my brain trying to work out how to connect to the LDAP server at work with access to search for info and import.
I have a couple of questions. Firstly, what is the difference between LDAP and Active Directory? I can get basic information by running some vba to look up computernames real names etc from active directory but our LDAP contains more information such as addresses, telephone numbers but most importantly company specific information such as user id numbers for some of our systems which I will need to be querying.
My issue is I cant get my head around creating an ADO connectiont o the LDAP to get this information. I have tried and failed numerous times and just reverted back to my Active Directory code.
I have downloaded an LDAP viewer so I have the full server address etc to get down to the required level. The program brings this up as the server address:
(edited out company name etc)
But I can never work out how exactly to put that part in to the code.
Does anyone have an example of what is possible? And also how I would place the server in to code correctly. I think the server part is the major downfall.
The code I have been using as a basis:
When I run the above code I get "Table does not exist"
Basically I have been destroying my brain trying to work out how to connect to the LDAP server at work with access to search for info and import.
I have a couple of questions. Firstly, what is the difference between LDAP and Active Directory? I can get basic information by running some vba to look up computernames real names etc from active directory but our LDAP contains more information such as addresses, telephone numbers but most importantly company specific information such as user id numbers for some of our systems which I will need to be querying.
My issue is I cant get my head around creating an ADO connectiont o the LDAP to get this information. I have tried and failed numerous times and just reverted back to my Active Directory code.
I have downloaded an LDAP viewer so I have the full server address etc to get down to the required level. The program brings this up as the server address:
Code:
ldap://scd2ldap.company.net:389/cn=GEEUER ANTJEE Z001VFMP S,l=SGX P,ou=E F,o=SUBCOMPANY,c=ES??base?(objectClass=*)
But I can never work out how exactly to put that part in to the code.
Does anyone have an example of what is possible? And also how I would place the server in to code correctly. I think the server part is the major downfall.
The code I have been using as a basis:
Code:
Sub returnit()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection
conn.Provider = "ADSDSOObject"
conn.Open "ADs Provider"
Set rs = conn.Execute( _
"<LDAP://scd2ldap.COMPANY.net:389/o=SUBCOMPANY/ou=E F/cn=GEUEER ANTJEEE Z001VFMP S>;" _
& "(objectClass=*);ADsPath,objectClass,cn;subtree")
While Not rs.EOF
Debug.Print rs.Fields(0).Value, rs.Fields(1).Value, _
rs.Fields(2).Value
rs.MoveNext
Wend
conn.Close
End Sub
Comment