User93267240 posted
I am trying to get user AD entry information using the entry's property dictionary. I want to get specific user info (ie account locked, etd); however, when I view the keys for entry's property dictionary I do not see a key for
userAccountControl and when I run the code the user.Properties["userAccountControl"].Value returns null. What am I doing wrong? see code below:
DirectoryEntry user = new DirectoryEntry("LDAP://" + server +
"/" +
objectDn, userName, password);
int val = (int)user.Properties["userAccountControl"].Value;
//newUser is DirectoryEntry object
user.Properties["userAccountControl"].Value = val | 0x80000;