Query and Wildcardshttp://forums.asp.net/t/1746569.aspx/1?Query+and+WildcardsTue, 06 Dec 2011 17:55:37 -050017465694716591http://forums.asp.net/p/1746569/4716591.aspx/1?Query+and+WildcardsQuery and Wildcards <p>Is there a way to query active directory on the managers field using wildcards?</p> <p>manager's distinquished name</p> <p>&nbsp;manager=CN=&quot; &amp; strMgr &amp; &quot;,OU=???,OU=Locations,DC=some value,DC=some value</p> <p>I am looking to do a query using the above filter but the office location field as a wildcard.&nbsp; Can this be done?</p> <p>Thank you</p> 2011-12-05T20:48:06-05:004716706http://forums.asp.net/p/1746569/4716706.aspx/1?Re+Query+and+WildcardsRe: Query and Wildcards <p>You can do (&amp;(objectclass=user)(manager= &quot;&nbsp;&amp;&nbsp;strMgr &amp; &quot;)(physicalDeliveryOfficeName=*))</p> <p>If you want get all values you can use * as a wildcard. Or replace them with a variable to narrow your results. However its important to point out the &quot;OU=blah, OU=blah blah&quot;&nbsp;part of the distinquished&nbsp;name refers to the location of that object in the directory, so you will have to make sure you get the path to those locations correct. You may want to populate&nbsp;a dropdown list with the manager distinquished names from AD instead. If you have all the managers in a security group or distribution list, this will be easy because their names will be stored in that form already. And you can just retrieve their names from the list. You will of course want to display their full name in the display to choose from.</p> 2011-12-05T22:56:15-05:004717911http://forums.asp.net/p/1746569/4717911.aspx/1?Re+Query+and+WildcardsRe: Query and Wildcards <p>Is it possible to use the * wildcard for the first OU=?&nbsp; The&nbsp;way that my current employer has AD setup there are different office locations for 1 particular folder and they don't want to change so I need to get all of those records.</p> <p>Thank you</p> 2011-12-06T12:44:04-05:004718435http://forums.asp.net/p/1746569/4718435.aspx/1?Re+Query+and+WildcardsRe: Query and Wildcards <p></p> <blockquote><span class="icon-blockquote"></span> <h4>teklaw</h4> <p></p> <p>Is it possible to use the * wildcard for the first OU=?&nbsp; The&nbsp;way that my current employer has AD setup there are different office locations for 1 particular folder and they don't want to change so I need to get all of those records.</p> <p>Thank you</p> <p></p> </blockquote> <p></p> <p>You can use a wildcard just for that part if you wish, but you have to make sure the user object is located in that OU or the distinquished name will not be valid. The distinguished name is the person's full name and path to the object in AD. So if the account for Bob Smith is located in root &gt; Users &gt; Finance, that listing of OUs in order will be displayed in his distinguished name.</p> <p>What is it exactly that you are trying to search for? If you want to just pull all users out of a particular you can do that with your search filter for example:&nbsp;(&amp;(ObjectClass=User)(OU=Finance))</p> 2011-12-06T17:48:35-05:004718441http://forums.asp.net/p/1746569/4718441.aspx/1?Re+Query+and+WildcardsRe: Query and Wildcards <p>I went in a different direction.&nbsp; I created a query based on the logged in user and then did a search on the directReports field.&nbsp; If that was filled in then create a query to get the information based on each of the user listed in that field.&nbsp; I was able to get this to work.</p> <p>Thanks for your help again.&nbsp; I think I am getting the hang of this.&nbsp; LOL</p> 2011-12-06T17:55:37-05:00