简体   繁体   中英

How to update AD User's Full name (Not Display Name) via c#

Existing answers confuse "Full name" with Display name. I can update AD user properties via c# (eg I can update First name, Last name, Display name) but not "Full name"

To see Full name search for a user in AD and in results right click on name and select Rename and "Full name" field is displayed along with name surname and display name

"Full name" is different from Display name (or name/surname or combinations) and can have different value. By default Full name is set to username and I need to change it to be same as display name.

Does anyone know how to update 'Full name' value using c#? Thanks

It is actually rename method that changes the full name, (or the name shown in results when queried via manual AD search.

string myNewValue = "mySurname, myFirstName".Replace(",", "\\,"); //escape comma
userDirectoryEntry.Rename("CN=" + myNewValue);
userDirectoryEntry.CommitChanges();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM