title: Can't get user from Directoryentry
body: <p>I am getting crazy here, I'd really appreciate some help!
  simply I want to get user name or anything from Active Directory using DirectoryEntry class.</p>
  
  <p>I used userprinciple and it works great, but the property I need to get (user's manager) is only avaliable in DirectoryEntry.</p>
  
  <p>My problem is, I looked so much online and I got the codes from there, but for some reason it never works, always return Null. here is an example :</p>
  
  <pre><code>public static DirectoryEntry GetUser(string UserName)
  {
      //create an instance of the DirectoryEntry
      DirectoryEntry de = new DirectoryEntry("LDAP://" + "OU=AnotherOU,OU=xx,OU=Testvironments,DC=abc,DC=local");
  
      //create instance fo the direcory searcher
      DirectorySearcher deSearch = new DirectorySearcher(de);
  
      deSearch.SearchRoot = de;
      //set the search filter
      deSearch.Filter = "(&amp;(objectCategory=user)(cn=" + UserName + "))";
      //deSearch.SearchScope = SearchScope.Subtree;
  
      //find the first instance
      SearchResult results = deSearch.FindOne();
  
      //if found then return, otherwise return Null
      if (results != null)
      {
          //de= new DirectoryEntry(results.Path,ADAdminUser,ADAdminPassword,AuthenticationTypes.Secure);
          //if so then return the DirectoryEntry object
          return results.GetDirectoryEntry();
      }
      else
      {
          return null;
      }
  }
  </code></pre>
  
  <p>I have no clue why this code returns null.</p>
  
  <p>Thanks in advance. </p>