Domain 2008 R2, DC. Administrator. DelphiXe2.
I Get User's info with ADOConnection1.SQL:
select extensionAttribute1, extensionAttribute2, cn, sn, givenname, displayName, sAMAccountName, userPrincipalName, mail, title, telephonenumber, company, department, description, objectSid, physicalDeliveryOfficeName, userAccountControl from 'LDAP://dc=ru/dc=mydomain/OU=User' where objectCategory = 'person' and objectClass='user' and userAccountControl<>514 and userAccountControl<>546 order by name
All work normal. I put new user:
Uses ActiveDs_TLB, ActiveX, ComObj;
..
var Usr: IADsUser; Comp: IADsContainer;
begin
try
CoInitialize(nil);
Comp:=GetObject('WinNT://localhost') as IADsContainer;
Usr:=comp.Create('user','Koko') as IADsUser;
usr.SetPassword('Fa123456789');
// usr.FirstName:='Pups';
Usr.SetInfo;
except ..
end;
end;
Questions:
- The code above works normally when I add the new user. But if I try to add what or property, for example FirstName (unRem usr. FirstName), I receive error E_ADS_SCHEMA_VIOLATION. How it to treat?
- Prompt, as by means of properties Usr:IADsUser; to change the expanded attributes, for example "extensionAttribute1"?
- Whether it is possible to add the new user by means of inquiry ADOConnection1.SQL or to change properties of the specified user?
Or how correctly to add the user with all attributes in active directory?