public static List <LdapEntry> Children(this LdapEntry entry, LdapConnection connection) { //string filter = "(&(objectclass=user))"; List <LdapEntry> entryList = new List <LdapEntry>(); LdapSearchResults lsc = connection.Search(entry.DN, LdapConnection.SCOPE_ONE, "objectClass=*", null, false); if (lsc == null) { return(entryList); } while (lsc.HasMore()) { LdapEntry nextEntry = null; try { nextEntry = lsc.Next(); if (nextEntry.IsUser() || nextEntry.IsOrganizationalUnit()) { entryList.Add(nextEntry); } } catch (LdapException e) { continue; } } return(entryList); }