FengShui1998
MIS
Hello,
I hope someone will be able to help me with an LDAP query.
The code below is returning one record, but when I try to display the value of "sn", nothing is returned, but I can see it the the GUI.
Does anyone have any ideas?
Thanks in advance,
fengshui1998
CONST ADS_SERVER_BIND = &H0200
strUser = "cn=Manager,dc=myCompany,dc=com"
strPassword = "xxxxxxx"
strServer = "160.22.74.136"
strDNSDomain = "ou=mcs,dc=myCompany,dc=com"
strBase = "<LDAP://" & strServer & "/" & strDNSDomain & ">"
strFilter = "(&(objectClass=person)(cn=1111111))"
Set objNS = GetObject("LDAP:")
Set objRootDSE = objNS.OpenDSObject("LDAP://" & strServer & "/" & strDNSDomain, strUser, strPassword, ADS_SERVER_BIND)
Set oConnection = CreateObject("ADODB.Connection")
oConnection.Open "Provider=ADsDSOObject;"
Set oCommand = CreateObject("ADODB.Command")
oCommand.ActiveConnection = oConnection
oCommand.CommandText = strBase & ";" & strFilter & ";sn;subtree"
Set rs = oCommand.Execute
msgbox rs.recordcount
Do While NOT rs.eof
msgbox rs("sn")
Loop
I hope someone will be able to help me with an LDAP query.
The code below is returning one record, but when I try to display the value of "sn", nothing is returned, but I can see it the the GUI.
Does anyone have any ideas?
Thanks in advance,
fengshui1998
CONST ADS_SERVER_BIND = &H0200
strUser = "cn=Manager,dc=myCompany,dc=com"
strPassword = "xxxxxxx"
strServer = "160.22.74.136"
strDNSDomain = "ou=mcs,dc=myCompany,dc=com"
strBase = "<LDAP://" & strServer & "/" & strDNSDomain & ">"
strFilter = "(&(objectClass=person)(cn=1111111))"
Set objNS = GetObject("LDAP:")
Set objRootDSE = objNS.OpenDSObject("LDAP://" & strServer & "/" & strDNSDomain, strUser, strPassword, ADS_SERVER_BIND)
Set oConnection = CreateObject("ADODB.Connection")
oConnection.Open "Provider=ADsDSOObject;"
Set oCommand = CreateObject("ADODB.Command")
oCommand.ActiveConnection = oConnection
oCommand.CommandText = strBase & ";" & strFilter & ";sn;subtree"
Set rs = oCommand.Execute
msgbox rs.recordcount
Do While NOT rs.eof
msgbox rs("sn")
Loop