M
Mario Rodriguez
Hi, I'm trying to add a new user to my active directory, but the problem is
that the following snippet doesn't throws any exception or error, but never
adds the users to the active directory
public DirectoryEntry addUser(UserContainer v_objUserContainer) {
if(impersonateUser(this.LoginUsername, this.DomainName,
this.strPassword)) { // make the operation with an privileged user
DirectoryEntry entry =
objRootActiveDirectory.Children.Add(v_objUserContainer.getLogin(), "user");
/* solamente modifica el password si esta definido */
if(v_objUserContainer.getPassword() != "" &&
v_objUserContainer.getPassword() != null) {
entry.Invoke("SetPassword", new object[]
{v_objUserContainer.getPassword() });
}
invokeProperty(ref entry, "FullName"
,v_objUserContainer.getFullName());
objRootActiveDirectory.CommitChanges();
undoImpersonification();
return entry;
} else {
return null;
}
}
Any idea ?
thanks
that the following snippet doesn't throws any exception or error, but never
adds the users to the active directory
public DirectoryEntry addUser(UserContainer v_objUserContainer) {
if(impersonateUser(this.LoginUsername, this.DomainName,
this.strPassword)) { // make the operation with an privileged user
DirectoryEntry entry =
objRootActiveDirectory.Children.Add(v_objUserContainer.getLogin(), "user");
/* solamente modifica el password si esta definido */
if(v_objUserContainer.getPassword() != "" &&
v_objUserContainer.getPassword() != null) {
entry.Invoke("SetPassword", new object[]
{v_objUserContainer.getPassword() });
}
invokeProperty(ref entry, "FullName"
,v_objUserContainer.getFullName());
objRootActiveDirectory.CommitChanges();
undoImpersonification();
return entry;
} else {
return null;
}
}
Any idea ?
thanks