Пример #1
0
        private void Create_Click(object sender, System.EventArgs e)
        {
            DSTools PropertyTool = new DSTools();

            PropertyTool.CreateMailbox(DisplayName.Text, Alias.Text);

            this.Close();
        }
        private void btnPopulate_Click(object sender, System.EventArgs e)
        {
            int     resultCounter = 0;
            DSTools PropertyTool  = new DSTools();
            String  filterString  = "";

            DirectoryObjects.Items.Clear();

            if (Input.Text == "")
            {
                // Using the filter string for All Users
                filterString = "(& (mailnickname=*)(|(&(objectCategory=person)(objectClass=user))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))))";
            }
            else
            {
                filterString = Input.Text;
            }

            SearchResultCollection SearchResults = PropertyTool.FindDirectoryObjects(LDAPPath.Text, filterString);

            m_LDAPPaths = new String[SearchResults.Count];

            try
            {
                foreach (SearchResult result in SearchResults)
                {
                    ResultPropertyCollection coll = result.Properties;

                    // Since we know that this is a 1-item property, we can jump directly
                    // to its item 0, otherwise, a foreach would have worked fine
                    DirectoryObjects.Items.Add(result.Properties["name"][0].ToString());

                    // Get the LDAP path for the object
                    m_LDAPPaths[resultCounter] = result.GetDirectoryEntry().Path;
                    resultCounter++;
                }
            }
            catch (Exception ex)
            {
                Output.Text = ex.Message;
            }
        }
        private void Deleter_Click(object sender, System.EventArgs e)
        {
            DSTools PropertyTool = new DSTools();

            PropertyTool.DeleteMailbox(m_LDAPPaths[DirectoryObjects.SelectedIndex]);
        }
        private void DirectoryObjects_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            DSTools PropertyTool = new DSTools();

            Output.Text = PropertyTool.DisplayDEProperties(m_LDAPPaths[DirectoryObjects.SelectedIndex]);
        }
        private void btnShowProperties_Click(object sender, System.EventArgs e)
        {
            DSTools PropertyTool = new DSTools();

            Output.Text = PropertyTool.DisplayDEProperties(LDAPPath.Text);
        }