/// <summary> /// Implements a multi-object search /// </summary> /// <param name="value">Object name to search for</param> private void Many_User_Search(string value, string field="displayName") { Boolean success = false; ADObjectFactory factory = new ADObjectFactory(ad); //Clear out the data userBinding.Clear(); //Disable controls set_Control_Enable(false); try { //For each Princpal returned by ad.Find... foreach (Principal item in ad.Find(new BaseCriteria(field, value))) { //Create an ADObject using the factory, and add it to the binding userBinding.Add(factory.toADObject(item)); //Enable user controls set_Control_Enable(true); } success = true; } catch (Exception ex) { //If we get an error, display the message in a message box Error_Message(ex.Message); } //Reset the bindings to update bound controls userBinding.ResetBindings(false); //Set the status text Set_Status("Search " + toSucceeded(success)); }