title: Using UserPrincipal.FindByIdentity and PrincipalContext with nested OU
body: <p>Here is what I am trying to achieve:
  I have a nested OU structure that is about 5 levels deep.</p>
  
  <pre><code>OU=Portal,OU=Dev,OU=Apps,OU=Grps,OU=Admin,DC=test,DC=com
  </code></pre>
  
  <p>I am trying to find out if the user has permissions/exists at OU=Portal.</p>
  
  <p>Here's a snippet of what I currently have:</p>
  
  <pre><code>PrincipalContext domain = new PrincipalContext(
      ContextType.Domain,
      "test.com",
      "OU=Portal,OU=Dev,OU=Apps,OU=Grps,OU=Admin,DC=test,DC=com");
  
  UserPrincipal user = UserPrincipal.FindByIdentity(domain, myusername);
  PrincipalSearchResult&lt;Principal&gt; group = user.GetAuthorizationGroups();
  </code></pre>
  
  <p>For some unknown reason, the value <code>user</code> generated from the above code is always null. However, if I were to drop all the OU as follows:</p>
  
  <pre><code>PrincipalContext domain = new PrincipalContext(
      ContextType.Domain,
      "test.com",
      "DC=test,DC=com");
  
  UserPrincipal user = UserPrincipal.FindByIdentity(domain, myusername);
  PrincipalSearchResult&lt;Principal&gt; group = user.GetAuthorizationGroups();
  </code></pre>
  
  <p>this would work just fine and return me the correct user. I am simply trying to reduce the number of results as opposed to getting everything from AD.</p>
  
  <p>Is there anything that I am doing wrong? I've Googled for hours and tested various combinations without much luck.</p>