Sub AnnuaireLdap()
Dim sNomLDAP As String
On Error GoTo Err
Set rs = CreateObject("ADODB.Recordset")
conn = "Provider=ADSDSOObject"
attrs = "adspath"
filtre = "(mail=" & "augustine.dupond@toto.fr" & ")"
' OU : filtre = "(sn=" & "DUPOND" & ")"
dom = "ou=centrale,ou=mefi,o=gouv,c=fr"
req = "<LDAP://proxyldap.alize/" & dom & ">;" & filtre & ";adspath;subtree"
rs.Open req, conn
While Not rs.EOF
Set titi = GetObject(rs("adspath"))
sNomLDAP = titi.Get("CN")
MsgBox sNomLDAP
Service = titi.Get("ouSigle")
MsgBox Service
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
Set fld = Nothing
Err:
MsgBox Err.Description
End Sub