1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
protected void organization_select_manager_B_CHECKNAME_Click(object sender, EventArgs e)
{
Page.RegisterClientScriptBlock("", "<script>alert("Recherche en cours");</script>");
try
{
foreach (ListItem it in organization_manager_select_LB_LIST.Items)
{
organization_manager_select_LB_LIST.Items.Remove(it);
}
DirectoryEntry ldap = new DirectoryEntry(u.LDAPPATH);
DirectorySearcher searcher = new DirectorySearcher(ldap);
searcher.Filter = "(cn=*" + organization_select_manager_T_MANAGER_ENTRY.Text + "*)";
searcher.SearchScope = SearchScope.Subtree;
try
{
SearchResultCollection results = searcher.FindAll();
foreach (SearchResult result in results)
{
DirectoryEntry manager = result.GetDirectoryEntry();
ListItem l = new ListItem((string)manager.Properties["displayName"].Value, (string)manager.Properties["distinguishedName"].Value);
organization_manager_select_LB_LIST.Items.Add(l);
}
}
catch (NullReferenceException ex)
{
organization_select_manager_L_ERROR.Text = "No entry: " + ex.Message;
}
}
catch (Exception ex)
{
organization_select_manager_L_ERROR.Text = ex.Message;
}
} |
Partager