title: find if user account is enabled or disabled in AD
body: <p>I need to find if user account is enabled or disabled in AD.</p>
  
  <p>i Cant find the flag or property <strong>"userAccountControl"</strong>.
  is this can be achieved using USERPRINCIPAL class?</p>
  
  <pre><code>        drop_persona1.Items.Clear();
          string valor = drop_area.SelectedValue;
  
              List&lt;string&gt; allUsers = new List&lt;string&gt;();
  
         PrincipalContext ctx2 = new PrincipalContext(ContextType.Domain, "xxxxxxxx",
                                                          valor);
  
  
              UserPrincipal qbeUser2 = new UserPrincipal(ctx2);
              qbeUser2.Enabled = true; // activo para autenticacion
  
              PrincipalSearcher srch2 = new PrincipalSearcher(qbeUser2);
              srch2.QueryFilter = qbeUser2;    
  
              foreach (var found2 in srch2.FindAll().OrderBy(x=&gt; x.DisplayName))
              {
                  ListItem lst_user = new ListItem(found2.DisplayName, found2.SamAccountName);
                  drop_persona1.Items.Insert(drop_persona1.Items.Count, lst_user);
              }
  
          //}
      }
  </code></pre>
  
  <p>Regards</p>