Re: How do I filter an Active Directory search to an OU (organizational unit)?
From: Jeff Connelly (nomail_at_thank.you)
Date: 04/13/05
- Next message: Nicole Calinoiu: "Re: Using HttpContext from a web server?"
- Previous message: Joe Kaplan \(MVP - ADSI\): "Re: How do I filter an Active Directory search to an OU (organizational unit)?"
- In reply to: JohnH.: "How do I filter an Active Directory search to an OU (organizational unit)?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 13 Apr 2005 15:45:43 -0400
"JohnH." <john@jrcc.net> wrote in message
news:1113420053.573364.223360@l41g2000cwc.googlegroups.com...
> Hi,
>
> I need to be able to retrieve a list of the users in an OU. The
> following C# code works just fine and dumps out a list of all of the
> user objects in all OUs in our active directory. I have not been able
> to figure out the filtering syntax to get this to just display the
> users in an OU. If anybody has any suggestions I'd be very
> appreciative. I've searched the online help, web, and news groups.
> I must not be understanding some fundamental concept here because
> nothing I have tried has worked.
>
> using System;
> using System.DirectoryServices;
>
> namespace ADSearch
> { public class ADRead
> {
> static void Main(string[] args)
> {
> DirectoryEntry entry = new DirectoryEntry
> ("LDAP://jrcc.local");
I think the easiest thing to do here would be to refine your LDAP string.
(LDAP syntax is confusing because several different looking syntaxes are
allowed - it's not consistent. I'll show you one syntax that should work -
there are others.) Let's say you had on the jrcc.local domain an OU called
MyBusiness (common), and then below that an OU called Users. You would use
LDAP://OU=Users,OU=MyBusiness,DC=jrcc,DC=local
That sets your LDAP path to point to that node, your filter does the rest of
the work. Although you might find you don't need your filter anymore.
- Next message: Nicole Calinoiu: "Re: Using HttpContext from a web server?"
- Previous message: Joe Kaplan \(MVP - ADSI\): "Re: How do I filter an Active Directory search to an OU (organizational unit)?"
- In reply to: JohnH.: "How do I filter an Active Directory search to an OU (organizational unit)?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|