El 24/9/21 a les 14:04, Dalacu Marius via synalist-public ha escrit:
Hi.
The problem is that i don't know how to use TLDAPSend.Add function.
I don't know what i have to put in the parameters.
Public <http://synapse.ararat.cz/doc/help/legend.html> |function *Add*(obj: AnsiString; const Value: TLDAPAttributeList <http://synapse.ararat.cz/doc/help/ldapsend.TLDAPAttributeList.html>): Boolean;|

Add list of attributes to specified object.


What does *obj *stands for? Is it the DN of the resulting object, is ith the DN of the OU that the object will reside in?

It's the DN of the new user.

I have tried every combination that I could think of....
Any help will be appreciated :-)

Check if you're missing any required attribute (the AD schema documentation should specify which attributes are mandatory and which are optional). At first sight I see you didn't assign an 'objectclass' attribute and I think that's required.

procedure TForm1.MenuItem21Click(Sender: TObject);         // Popup2 - Create user
var
   aAttr:TLDAPAttribute;
   aAttrList:TLDAPAttributeList;
   sResultText:string;
begin
   ldapReBind;

   //aAttr:=TLDAPAttribute.Create;
   aAttrList:=TLDAPAttributeList.Create;

   aAttr:=aAttrList.Add;
   aAttr.AttributeName:='sn';
   aAttr.Add('srlDMTest');

   aAttr:=aAttrList.Add;
   aattr.Clear;
   aAttr.AttributeName:='cn';
/  //aAttr.Add('srlDMTest')/
aAttr.Add('CN=srlDMTest,OU=Risk,OU=Users,OU=Leasing,OU=Subsidiary,OU=RBRO,DC=RBRO,DC=RBG,DC=CC'); aAttrList[1].ValueFromIndex[0]:='CN=srlDMTest,OU=Risk,OU=Users,OU=Leasing,OU=Subsidiary,OU=RBRO,DC=RBRO,DC=RBG,DC=CC'; //aAttr.Add, truncates the first part of the string, why?!
   aAttr:=aAttrList.Add;
   aAttr.AttributeName:='sAMAccountName';
   aAttr.Add('srlDMTest');

/{  aAttr:=aAttrList.Add;/
/  aAttr.AttributeName:='name';/
/  aAttr.Add('srlDMTest');}/

/  //ShowMessage(intToStr(aAttrList.Count));/
   ShowMessage(aAttrList[1].AttributeName);
*ldap.Add(*'CN=srlDMTest,OU=Risk,OU=Users,OU=Leasing,OU=Subsidiary,OU=RBRO,DC=RBRO,DC=RBG,DC=CC',aAttrList);
/  //ldap.Add('',aAttrList);/
   ShowMessage(ldap.ResultString);

   aAttrList.Free;
   //aAttr.Free;
end;


_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to