Again, referencing the following example:
http://www.ararat.cz/synapse/doku.php/public:howto:ldapsampleI have this working now, returning my base domain search values. If you create a new project and include all the synapse pascal unit files found in the "uses" clauses
procedure TForm1.Button1Click(Sender: TObject);
var
ldap: TLDAPsend;
l: TStringList;
al: TLDAPAttribute;
begin
ldap:= TLDAPsend.Create;
l := TStringList.Create;
al := TLDAPAttribute.Create ;
try
ldap.TargetHost := '192.168.40.50';
*************** Had to change user to a domain admin
*************** below works using a domain admin, but I assume I can use
************** a non admin user with the appropriate rights
ldap.UserName := 'administrator@internal.mydoamin.com';
ldap.Password := 'PASSWORD123';
if ldap.Login then
if ldap.Bind then
begin
ShowMessage('Connected to LDAP');
//l.Add('displayname');
//l.Add('description');
//l.Add('givenName');
l.Add('mail');
//l.Add('*');
ldap.Search('OU=Users,OU=MM,DC=internal,DC=yourdomain,DC=com', False, '(objectclass=Person)', l);
memo1.Lines.Add(LDAPResultDump(ldap.SearchResult));
//memo1.Lines.Add
ldap.Logout;
end;
finally
ldap.Free;
end;
end;
What I'm after is how to get the user and email elements of the ldap query.
I'm not smart enough to figure this out without a little help.
I think I need to instantiate a TDLDAP Attribute class and load them, or they are already loading, but I can't figure it out.
I'm thinking I need to loop through the results...rather than use the LDAPResultDump function, which
is described as primarily used for debugging in the source code comments.
Haven't done a lot of programming using classes; when I started they didn't exist, and I'm
slow to catch the concepts.
Any hints appreciated.