title: LDAP: Query syntax
body: <p>I've basically forgotten everything I ever learned about querying AD, and now I have a need to retrieve the list of users in one particular dept (DAAS). I've determined that there is an Organizational Unit called DAAS. I just can't figure out how to limit the list to that OU. </p>
  
  <p>This string works, but retrieves the entire organization;</p>
  
  <pre><code>strQueryDL = "&lt;LDAP://" &amp; strDefaultNamingContext &amp; "&gt;;(&amp;(objectCategory=person)(objectClass=user));distinguishedName;subtree"
  </code></pre>
  
  <p>This string doesn't work; </p>
  
  <pre><code>strQueryDL = "&lt;LDAP://" &amp; strDefaultNamingContext &amp; "&gt;;(&amp;(objectCategory=person)(objectClass=user)(OU=DAAS));distinguishedName;subtree"
  </code></pre>
  
  <p>This string doesn't work, either; </p>
  
  <pre><code>strQueryDL = "&lt;LDAP://OU=DAAS" &amp; strDefaultNamingContext &amp; "&gt;;(&amp;(objectCategory=person)(objectClass=user));distinguishedName;subtree"
  </code></pre>
  
  <p>Where does that darn OU belong in this string?</p>
  
  <p>Thanks!
  DC</p>