title: How to determine if user account is enabled or disabled
body: <p>I am throwing together a quick C# win forms app to help resolve a repetitive clerical job.</p>
  
  <p>I have performed a search in AD for all user accounts and am adding them to a list view with check boxes.</p>
  
  <p>I would like to default the listviewitems' default check state to depend upon the enabled/disabled state of the account.</p>
  
  <pre><code>string path = "LDAP://dc=example,dc=local";
  DirectoryEntry directoryRoot = new DirectoryEntry(path);
  DirectorySearcher searcher = new DirectorySearcher(directoryRoot,
      "(&amp;(objectClass=User)(objectCategory=Person))");
  SearchResultCollection results = searcher.FindAll();
  foreach (SearchResult result in results)
  {
      DirectoryEntry de = result.GetDirectoryEntry();
      ListViewItem lvi = new ListViewItem(
          (string)de.Properties["SAMAccountName"][0]);
      // lvi.Checked = (bool) de.Properties["AccountEnabled"]
      lvwUsers.Items.Add(lvi);
  }
  </code></pre>
  
  <p>I'm struggling to find the right attribute to parse to get the state of the account from the DirectoryEntry object. I've searched for <a href="http://www.google.com/search?q=AD+User+attributes" rel="noreferrer">AD User attributes</a>, but not found anything useful.</p>
  
  <p>Can anyone offer any pointers?</p>