locked
DirectoryEntry entry return value's Properties key userAccountControl not found and returns null RRS feed

  • Question

  • 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;

    Tuesday, September 30, 2014 3:01 PM

Answers

  • User1508394307 posted

    Did you try to access LDAP under admin account to see if maybe there is an issue with a security?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 30, 2014 3:46 PM

All replies

  • User1508394307 posted

    Is user null too or it's pointed to the right DirectoryEntry?

    Tuesday, September 30, 2014 3:05 PM
  • User93267240 posted

    user comes back with everything. When; however, I look at the propereties Key values there are somewhere around 32 values but none are "userAccountControl".

    Tuesday, September 30, 2014 3:22 PM
  • User1508394307 posted

    Did you try to access LDAP under admin account to see if maybe there is an issue with a security?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 30, 2014 3:46 PM