Clearing Active Directory Values in C#
Posted by mundeep on August 5, 2008
To clear values in Active Directory they must be set to NULL and not “” or empty.
This can easily be done by using the Clear() method on the property value collection for the active directory field you wish to update.
using System.DirectoryServices;
public void ClearAdField(string fieldName, DirectoryEntry adEntry) {
PropertyValueCollection adValue = adEntry.Properties[fieldName];
adValue.Clear();
adEntry.CommitChanges();
}