コード例 #1
0
        /// <summary>
        /// Gets a specific public folder from Exchange and displays the information
        /// </summary>
        /// <param name="path"></param>
        private void GetPublicFolder(string path)
        {
            ExchCmds powershell = null;

            try
            {
                powershell = new ExchCmds(Config.ExchangeURI, Config.Username, Config.Password, Config.ExchangeConnectionType, Config.PrimaryDC);

                BasePublicFolder pf = powershell.Get_PublicFolder(path);
                txtPublicFolderName.Text = pf.Name;
                txtMaxItemSize.Text = pf.MaxItemSize;
                txtWarningSizeMB.Text = pf.IssueWarningQuota;
                txtProhibitPostMB.Text = pf.ProhibitPostQuota;
                txtAgeLimit.Text = pf.AgeLimit;
                txtKeepDeletedItems.Text = pf.RetainDeletedItemsFor;

                // Set our hidden field for the selected public folder
                hfPublicFolderPath.Value = pf.Path;

                if (pf.MailFolderInfo == null)
                {
                    // Set that the public folder currently isn't enabled for email
                    cbPFCurrentEmailEnabled.Checked = false;

                    txtDisplayName.Text = string.Empty;
                    txtPrimaryEmail.Text = string.Empty;
                    cbPFEnableEmail.Checked = false;
                }
                else
                {
                    // Set the the public folder IS currently enabled for email
                    cbPFCurrentEmailEnabled.Checked = true;

                    cbPFEnableEmail.Checked = true;
                    txtDisplayName.Text = pf.MailFolderInfo.DisplayName;
                    cbPFHiddenFromAddressLists.Checked = pf.MailFolderInfo.Hidden;

                    string[] emailSplit = pf.MailFolderInfo.EmailAddress.Split('@');
                    txtPrimaryEmail.Text = emailSplit[0];

                    ListItem item = ddlEmailDomains.Items.FindByValue(emailSplit[1]);
                    if (item != null)
                        ddlEmailDomains.SelectedValue = item.Value;
                }

                // Check if the user is a super admin or reseller admin.
                // If they are not we need to diasble the fields
                if (Master.IsSuperAdmin || Master.IsResellerAdmin)
                {
                    txtMaxItemSize.ReadOnly = false;
                    txtWarningSizeMB.ReadOnly = false;
                    txtProhibitPostMB.ReadOnly = false;
                    txtAgeLimit.ReadOnly = false;
                    txtKeepDeletedItems.ReadOnly = false;
                }
                else
                {
                    txtMaxItemSize.ReadOnly = true;
                    txtWarningSizeMB.ReadOnly = true;
                    txtProhibitPostMB.ReadOnly = true;
                    txtAgeLimit.ReadOnly = true;
                    txtKeepDeletedItems.ReadOnly = true;
                }
            }
            catch (Exception ex)
            {
                notification1.SetMessage(controls.notification.MessageType.Error, ex.Message);
            }
            finally
            {
                if (powershell != null)
                    powershell.Dispose();
            }
        }