Last post Jun 22, 2015 02:13 AM by Angie xu - MSFT
Jun 16, 2015 08:01 AM|Abdul Muqeet|LINK
i am trying to get sub ou of particular ou but i am getting all ou of active directory
i am trying below code for this process ,,
DirectoryEntry entry = new DirectoryEntry("LDAP://domain", null, null, AuthenticationTypes.Secure);
DirectorySearcher ds = new DirectorySearcher(entry, "objectClass= organizationalUnit", null, SearchScope.Subtree);
SearchResultCollection src = null;
foreach (SearchResult each in ds.FindAll())
string n = each.Properties["name"].ToString();
row = dtOU.NewRow();
row["item"] = n;
Jun 22, 2015 02:13 AM|Angie xu - MSFT|LINK
These resources are available for you to get a List of All the Users in an OU and Its Sub-OUs.
I Get a List of All the Users in an OU and Its Sub-OUs
List All the Sub-OUs in an OU
Hope it helps.