title: c# DirectoryEntry.Properties vs DirectoryEntry.InvokeGet?
body: <p>I have a strange problem when I tried to retrieve the "AccountExpirationDate" from the active directory.</p>
  
  <p>I use the following code to retrieve the user:</p>
  
  <pre><code>        DirectoryEntry dirEntry = new DirectoryEntry(Path);
          DirectorySearcher search = new DirectorySearcher(dirEntry);
  
          // specify the search filter
          search.Filter = "(&amp;(objectClass=user)(mail=" + email + "))";
  
          // perform the search
          SearchResult result = search.FindOne();
          DirectoryEntry user = result.GetDirectoryEntry();
  </code></pre>
  
  <p>And then I retrieve the "AccountExpirationDate":</p>
  
  <pre><code>object o1 = user.Properties["accountExpires"].Value; //return a COM object and I cannot retrieve anything from it
  object o2 = user.Properties["AccountExpirationDate"].Value; //return null
  object o3 = user.InvokeGet("AccountExpirationDate"); //return the DateTime
  </code></pre>
  
  <p>So I would like to what happened here?
  Why I cannot use DirectoryEntry.Properties to retrieve the AccountExpirationDate?
  What is the different between DirectoryEntry.Properties vs DirectoryEntry.InvokeGet?</p>
  
  <p>Thanks a lot.</p>