private void BindSettings() { try { // get settings ExchangeMailbox mailbox = ES.Services.ExchangeServer.GetMailboxGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID); //get statistics ExchangeMailboxStatistics stats = ES.Services.ExchangeServer.GetMailboxStatistics(PanelRequest.ItemID, PanelRequest.AccountID); // title litDisplayName.Text = mailbox.DisplayName; // bind form chkHideAddressBook.Checked = mailbox.HideFromAddressBook; chkDisable.Checked = mailbox.Disabled; lblExchangeGuid.Text = string.IsNullOrEmpty(mailbox.ExchangeGuid) ? "<>" : mailbox.ExchangeGuid; // get account meta ExchangeAccount account = ES.Services.ExchangeServer.GetAccount(PanelRequest.ItemID, PanelRequest.AccountID); // get mailbox plan ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, account.MailboxPlanId); ExchangeJournalRule rule = ES.Services.ExchangeServer.GetJournalRule(PanelRequest.ItemID, account.PrimaryEmailAddress); cbEnabled.Checked = rule.Enabled; ddlScope.SelectedValue = rule.Scope; ddlRecipient.SelectedValue = rule.Recipient; if (account.MailboxPlanId == 0) { mailboxPlanSelector.AddNone = true; mailboxPlanSelector.MailboxPlanId = "-1"; } else { mailboxPlanSelector.MailboxPlanId = account.MailboxPlanId.ToString(); } mailboxSize.QuotaUsedValue = Convert.ToInt32(stats.TotalSize / 1024 / 1024); mailboxSize.QuotaValue = (stats.MaxSize == -1) ? -1 : (int)Math.Round((double)(stats.MaxSize / 1024 / 1024)); if (account.LevelId > 0 && Cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) { EnterpriseServer.Base.HostedSolution.ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(account.LevelId); litServiceLevel.Visible = true; litServiceLevel.Text = serviceLevel.LevelName; litServiceLevel.ToolTip = serviceLevel.LevelDescription; } imgVipUser.Visible = account.IsVIP && Cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels); } catch (Exception ex) { messageBox.ShowErrorMessage("EXCHANGE_GET_JOURNALING_MAILBOX_SETTINGS", ex); } }
private string GetCapacityImage() { string result = string.Empty; ExchangeMailboxStatistics mailboxStatistics = ES.Services.ExchangeServer.GetMailboxStatistics(ItemId, AccountId); if (mailboxStatistics != null && mailboxStatistics.MaxSize > (long)0 && (double)mailboxStatistics.TotalSize / (double)mailboxStatistics.MaxSize > 0.9) { result = "<span class=\"fa fa-hdd-o fa-lg text-success\"></span>"; } if (mailboxStatistics != null && mailboxStatistics.MaxSize < (long)0 && (double)mailboxStatistics.TotalSize / (double)mailboxStatistics.MaxSize > 0.9) { result = "<span class=\"fa fa-hdd-o fa-lg text-danger\"></span>"; } return(result); }
public ExchangeMailboxStatistics GetMailboxStatistics(string accountName) { try { LogStart("GetMailboxStatistics"); ExchangeMailboxStatistics ret = ES.GetMailboxStatistics(accountName); LogEnd("GetMailboxStatistics"); return(ret); } catch (Exception ex) { Log.WriteError("GetMailboxStatistics", ex); throw; } }
private void BindSettings() { try { // get settings ExchangeMailbox mailbox = ES.Services.ExchangeServer.GetMailboxGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID); //get statistics ExchangeMailboxStatistics stats = ES.Services.ExchangeServer.GetMailboxStatistics(PanelRequest.ItemID, PanelRequest.AccountID); // mailbox plan // title litDisplayName.Text = mailbox.DisplayName; // bind form chkHideAddressBook.Checked = mailbox.HideFromAddressBook; chkDisable.Checked = mailbox.Disabled; lblExchangeGuid.Text = string.IsNullOrEmpty(mailbox.ExchangeGuid) ? "<>" : mailbox.ExchangeGuid; // get account meta ExchangeAccount account = ES.Services.ExchangeServer.GetAccount(PanelRequest.ItemID, PanelRequest.AccountID); // get mailbox plan ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, account.MailboxPlanId); chkPmmAllowed.Checked = (account.MailboxManagerActions & MailboxManagerActions.GeneralSettings) > 0; if (account.MailboxPlanId == 0) { mailboxPlanSelector.AddNone = true; mailboxPlanSelector.MailboxPlanId = "-1"; } else { mailboxPlanSelector.MailboxPlanId = account.MailboxPlanId.ToString(); } if (account.ArchivingMailboxPlanId < 1) { mailboxRetentionPolicySelector.MailboxPlanId = "-1"; } else { mailboxRetentionPolicySelector.MailboxPlanId = account.ArchivingMailboxPlanId.ToString(); } mailboxSize.QuotaUsedValue = Convert.ToInt32(stats.TotalSize / 1024 / 1024); mailboxSize.QuotaValue = (stats.MaxSize == -1) ? -1 : (int)Math.Round((double)(stats.MaxSize / 1024 / 1024)); secCalendarSettings.Visible = ((account.AccountType == ExchangeAccountType.Equipment) | (account.AccountType == ExchangeAccountType.Room)); secLitigationHoldSettings.Visible = mailbox.EnableLitigationHold; litigationHoldSpace.QuotaUsedValue = Convert.ToInt32(stats.LitigationHoldTotalSize / 1024 / 1024); litigationHoldSpace.QuotaValue = (stats.LitigationHoldMaxSize == -1) ? -1 : (int)Math.Round((double)(stats.LitigationHoldMaxSize / 1024 / 1024)); if (Utils.CheckQouta(Quotas.EXCHANGE2007_DISCLAIMERSALLOWED, Cntx)) { int disclaimerId = ES.Services.ExchangeServer.GetExchangeAccountDisclaimerId(PanelRequest.ItemID, PanelRequest.AccountID); ddDisclaimer.SelectedValue = disclaimerId.ToString(); } int ArchivingMaxSize = -1; if (plan != null) { ArchivingMaxSize = plan.ArchiveSizeMB; } chkEnableArchiving.Checked = account.EnableArchiving; archivingQuotaViewer.QuotaUsedValue = Convert.ToInt32(stats.ArchivingTotalSize / 1024 / 1024); archivingQuotaViewer.QuotaValue = ArchivingMaxSize; rowArchiving.Visible = chkEnableArchiving.Checked; if (account.LevelId > 0 && Cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) { WebsitePanel.EnterpriseServer.Base.HostedSolution.ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(account.LevelId); litServiceLevel.Visible = true; litServiceLevel.Text = serviceLevel.LevelName; litServiceLevel.ToolTip = serviceLevel.LevelDescription; } imgVipUser.Visible = account.IsVIP && Cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels); if (account.AccountType == ExchangeAccountType.SharedMailbox) { litDisplayName.Text += GetSharedLocalizedString("SharedMailbox.Text"); } if (account.AccountType == ExchangeAccountType.Room) { litDisplayName.Text += GetSharedLocalizedString("RoomMailbox.Text"); } if (account.AccountType == ExchangeAccountType.Equipment) { litDisplayName.Text += GetSharedLocalizedString("EquipmentMailbox.Text"); } } catch (Exception ex) { messageBox.ShowErrorMessage("EXCHANGE_GET_MAILBOX_SETTINGS", ex); } }