title: Active Directory : PropertiesToLoad get all properties
body: <p>I try to get a List of all properties from an Object in the Active Directory.</p>
  
  <p>What I have for now is this:</p>
  
  <pre><code>List&lt;User&gt; users = new List&lt;User&gt;();
  try
  {
      DirectoryEntry root = new DirectoryEntry("LDAP://RootDSE");
      root = new DirectoryEntry("LDAP://" + root.Properties["defaultNamingContext"][0]);
      DirectorySearcher search = new DirectorySearcher(root);
      search.Filter = "(&amp;(objectClass=user)(objectCategory=person))";
  
      search.PropertiesToLoad.Add("samaccountname");
      search.PropertiesToLoad.Add("displayname");
      search.PropertiesToLoad.Add("mail");
      search.PropertiesToLoad.Add("telephoneNumber");
      search.PropertiesToLoad.Add("department");
      search.PropertiesToLoad.Add("title");
  
      SearchResultCollection results = search.FindAll();
      if (results != null)
      {
          foreach (SearchResult result in results)
          {
              foreach (DictionaryEntry property in result.Properties)
              {
                  Debug.Write(property.Key + ": ");
                  foreach (var val in (property.Value as ResultPropertyValueCollection)) { 
                      Debug.Write(val +"; ");
                  }
                  Debug.WriteLine("");
              }
          }
      }
  }
  catch (Exception ex)
  {
  
  }
  </code></pre>
  
  <p>But it gets only the properties I added with PropertiesToLoad. Is it possible to get all properties dynamically?</p>