Needing LDAP access to be able to create some sort of Single Sign-On (SSO), I googled and created this testcode that is able to query the LDAP and place the results in a cursor.
This is the complete code, you just have to replace 3 important parameters: identified by the < > characters.
* Query LDAP from Foxpro
* Connecting: https://www.foxite.com/archives/active-directory-vfp-0000343854.htm
* Adodb to cursor: https://www.berezniker.com/content/pages/visual-foxpro/converting-ado-recordset-cursor-cursoradapter
Local loConnection As Adodb.Connection, loRecordSet As Adodb.Recordset
loConnection = Createobject('Adodb.Connection')
loConnection.Provider = "ADsDSOObject"
loConnection.Properties('User ID') = "<service user name>"
loConnection.Properties('Password') = "<service user password>"
loConnection.Properties('Encrypt Password') = .F.
loConnection.Open("Active Directory Provider")
lcServer = 'LDAP://<server>'
loRecordSet = loConnection.Execute([SELECT adsPath,displayName,givenName,sn, distinguishedName, userPrincipalName, sAmAccountName FROM ']+lcServer+[']+;
[Where objectClass = 'user' And objectCategory='Person'])
loCursor = CREATEOBJECT([CursorAdapter])
loCursor.Alias = [crLdap] && cursor Alias
loCursor.DataSourceType = [ADO]
loCursor.CursorFill(,,,loRecordSet) && fill corsor
loCursor.CursorDetach() && Detach cursor so it still be open after CursorAdapter is destroyed
loCursor = NULL
loConnection.Close