1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| LireUser_NomConnexion = "BLANC"
strADsPath="LDAP://dc=ENTREPRISE,dc=TEST"
Function Get_DistinguishedName(ByVal obj)
Dim oConnection
Dim oRecordset
Dim strQuery
Set oConnection = CreateObject("ADODB.Connection")
Set oRecordset = CreateObject("ADODB.Recordset")
Set objCmd = CreateObject("ADODB.Command")
oConnection.Provider = "ADsDSOObject" 'The ADSI OLE-DB provider
oConnection.Open "ADs Provider"
strQuery = "<" & strADsPath & ">;(&(cn=" + obj +"));distinguishedName;subtree"
Set objCmd.ActiveConnection = oConnection
objCmd.CommandText = strQuery
objCmd.Properties("Page Size") = 32
Set oRecordset = objCmd.Execute(strQuery)
If oRecordset.EOF And oRecordset.BOF Then
Get_DistinguishedName = ""
Else
Get_DistinguishedName = oRecordset.Fields("distinguishedName")
end if
End Function
Set LireLDAP_Utilisateur = GetObject("LDAP://" & Get_DistinguishedName(LireUser_NomConnexion))
LDAP_Nom = trim(LireLDAP_Utilisateur.lastname)
LDAP_Matricule = right(trim(LireLDAP_Utilisateur.EmployeeNumber),6)
response.write("<BR/>LDAP_Nom = " & LDAP_Nom)
response.write("<BR/>LDAP_Matricule = " & LDAP_Matricule) |
Partager