title: Using LDAP filter to find all results. Getting error message
body: <pre><code>DirectoryEntry testAD = new DirectoryEntry();    
  DirectorySearcher search = new DirectorySearcher(testAD);
  
  StringBuilder add = new StringBuilder();
  search.PropertiesToLoad.Add("mail");
  search.Filter = "(&amp;(objectClass=user))";
  
  foreach (SearchResult SearchAll in search.FindAll())
  {
      DirectoryEntry de = SearchAll.GetDirectoryEntry();
      add.Append(de.Properties["mail"].Value.ToString()); // error message here
  }
  
  PrefixDescription.Text = add.ToString();
  </code></pre>
  
  <p>I'm trying to find all emails first as a test and then all information (first name, last name, etc) and list it in a text box using a LPAR filter but I keep getting this error message when I run the app:</p>
  
  <blockquote>
    <p>Object reference not set to an instance of an object.</p>
  </blockquote>