[C#] Problème de OU dans requête LDAP
Bonjour,
Voilà j'ai un gros problème de requête LDAP.
Lorsque je désire rechercher les OU présente dans mon arborescence, je n'ai pas beaucoup de problème je fais ceci :
Code:
1 2 3 4 5 6 7 8 9
|
Directory Ldap = new DirectoryEntry("LDAP://10.120.0.20/dc=test,dc=local","Admin", "Password");
DirectorySearcher search = new Directory Searcher(Ldap);
search.Filter = "(&(objectClass=organizationalUnit)(anr=FED*))"; //Lister toutes les OU qui contiennent le mot FED.
foreach(SearchResult rs in search.FindAll())
{
DirectoryEntry DirEntry = rs.GetDirectoryEntry();
DropDownList1.Items.Add(DirEntry.Properties["name"].Value.ToString());
} |
J'obtiens bien mes 2 OU : FED1 et FED2.
Maintenant le problème :Lorsque je choisi l'une des FED, je dois faire une recherche pour afficher ce qu'elle contient :
Code:
1 2 3 4 5 6 7
| DirectoryEntry Ldap = new DirectoryEntry("LDAP://10.120.0.20/OU=" + DropDownList1.SelectedItem.Value + ",dc=test,dc=local","Admin", "Password");
DirectorySearcher search = new DirectorySearcher(Ldap);
foreach(SearchResult rs in search.FindAll()
{
DirectoryEntry DirEntry = rs.GetDirectoryEntry();
DropDownList2.Items.Add(DirEntry.Properties["name"].Value.ToString());
} |
MAIS rien ne s'affiche dans la DropDownList2, apparement la requête Ldap :
Code:
("LDAP://10.120.0.20/OU=" + DropDownList1.SelectedItem.Value + ",dc=test,dc=local","Admin", "Password");
ne fonctionne pas !!!
Vous n'avez pas une idée ?