I need update a specific user ldap with new custom attributes. When run throw Exception "Unhandled Exception: System.DirectoryServices.DirectoryServicesCOMException: The specified directory service attribute or value does not exist". My code is:
using (var entryRoot = new DirectoryEntry("LDAP://ldap.com:389/OU=CATALOG,DC=ldap,DC=com", "juan", "juan2016", AuthenticationTypes.Secure)){
DirectorySearcher user_searcher = new DirectorySearcher(entryRoot);
user_searcher.Filter = $"(&(objectCategory=person)(objectClass=user)(samAccountName={cn1}))"
user_searcher.PropertiesToLoad.Add("identification");
SearchResultCollection result = user_searcher.FindAll();
DirectoryEntry user_ldap = result[0].GetDirectoryEntry();
user_ldap.Properties["identification"].Value = identification;
user_ldap.CommitChanges();
}
identificationattribute to your schema manually? It's not a valid attribute out of the box.