I want to change the user .NET applications from Active Directory in my application.
Now I change it like this:
DirectoryEntry userToUpdate = updatedUser.GetDirectoryEntry(); userToUpdate.Properties["sAMAccountName"].Value = user.NewLogin; userToUpdate.CommitChanges();
But it does not work as I expect. When I check the "Active Directory Users and Computers" entry for this user, then on the "account" tab, I see that:
- The "Username" property is not updated
- Fixed updating the property "Login to login (pre-Windows 2000)."
How to update username in AD from C # code? What property should I set in DirectoryEntry, or is there another way to change the username.
source share