private void OnImportClick(object sender, EventArgs e) { List <DirectoryEntry> accounts = new List <DirectoryEntry>(); foreach (ListViewItem item in lvUsers.Items) { if (item.Checked) { accounts.Add((DirectoryEntry)item.Tag); } } Global.SelectedAccounts = accounts; Global.OrganizationName = txtOrgName.Text; Global.ImportAccountsOnly = rbImport.Checked; Global.HasErrors = false; Global.defaultMailboxPlanId = 0; if (cbMailboxPlan.SelectedItem != null) { ExchangeMailboxPlan plan = cbMailboxPlan.SelectedItem as ExchangeMailboxPlan; if (plan != null) { Global.defaultMailboxPlanId = plan.MailboxPlanId; } } importer.Initialize(this.username, this); importer.Start(); }
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); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Utils.CheckQouta(Quotas.EXCHANGE2007_DISCLAIMERSALLOWED, Cntx)) { ddDisclaimer.Items.Add(new System.Web.UI.WebControls.ListItem("None", "-1")); ExchangeDisclaimer[] disclaimers = ES.Services.ExchangeServer.GetExchangeDisclaimers(PanelRequest.ItemID); foreach (ExchangeDisclaimer disclaimer in disclaimers) { ddDisclaimer.Items.Add(new System.Web.UI.WebControls.ListItem(disclaimer.DisclaimerName, disclaimer.ExchangeDisclaimerId.ToString())); } } else { locDisclaimer.Visible = false; ddDisclaimer.Visible = false; } BindSettings(); UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId); if (user != null) { if ((user.Role == UserRole.User) & (Utils.CheckQouta(Quotas.EXCHANGE2007_ISCONSUMER, Cntx))) { chkHideAddressBook.Visible = false; chkDisable.Visible = false; } } secRetentionPolicy.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, Cntx); if (GetLocalizedString("buttonPanel.OnSaveClientClick") != null) { buttonPanel.OnSaveClientClick = GetLocalizedString("buttonPanel.OnSaveClientClick"); } } int planId = -1; int.TryParse(mailboxPlanSelector.MailboxPlanId, out planId); ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, planId); if (plan != null) { secArchiving.Visible = plan.EnableArchiving; secLitigationHoldSettings.Visible = plan.AllowLitigationHold && Utils.CheckQouta(Quotas.EXCHANGE2007_ALLOWLITIGATIONHOLD, Cntx); } else { secArchiving.Visible = false; secLitigationHoldSettings.Visible = false; } }
private bool PlanExists(ExchangeMailboxPlan plan, ExchangeMailboxPlan[] plans) { bool result = false; foreach (ExchangeMailboxPlan p in plans) { if (p.MailboxPlan.ToLower() == plan.MailboxPlan.ToLower()) { result = true; break; } } return(result); }
protected void gvMailboxPlan_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteItem") { int mailboxPlanId = Utils.ParseInt(e.CommandArgument.ToString(), 0); try { ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, mailboxPlanId); if (plan.MailboxPlanType > 0) { ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN"); BindMailboxPlans(); return; } int result = ES.Services.ExchangeServer.DeleteExchangeMailboxPlan(PanelRequest.ItemID, mailboxPlanId); if (result < 0) { messageBox.ShowResultMessage(result); return; } else { ShowSuccessMessage("REQUEST_COMPLETED_SUCCESFULLY"); } } catch (Exception) { messageBox.ShowErrorMessage("EXCHANGE_DELETE_MAILBOXPLAN"); } BindMailboxPlans(); } }
protected void Page_Load(object sender, EventArgs e) { PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); if (!IsPostBack) { BindPasswordSettings(); string instructions = ES.Services.ExchangeServer.GetMailboxSetupInstructions(PanelRequest.ItemID, PanelRequest.AccountID, false, false, false, " "); if (!string.IsNullOrEmpty(instructions)) { chkSendInstructions.Checked = chkSendInstructions.Visible = sendInstructionEmail.Visible = true; PackageInfo package = ES.Services.Packages.GetPackage(PanelSecurity.PackageId); if (package != null) { UserInfo user = ES.Services.Users.GetUserById(package.UserId); if (user != null) { sendInstructionEmail.Text = user.Email; } } } else { chkSendInstructions.Checked = chkSendInstructions.Visible = sendInstructionEmail.Visible = false; } SolidCP.Providers.HostedSolution.ExchangeMailboxPlan[] plans = ES.Services.ExchangeServer.GetExchangeMailboxPlans(PanelRequest.ItemID, false); if (plans.Length == 0) { btnCreate.Enabled = false; } bool allowResourceMailbox = false; if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER)) { if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) { locSubscriberNumber.Visible = txtSubscriberNumber.Visible = valRequireSubscriberNumber.Enabled = false; allowResourceMailbox = true; } } if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2013_RESOURCEMAILBOXES)) { if (cntx.Quotas[Quotas.EXCHANGE2013_RESOURCEMAILBOXES].QuotaAllocatedValue != 0) { allowResourceMailbox = true; } } if (allowResourceMailbox) { rbMailboxType.Items.Add(new System.Web.UI.WebControls.ListItem(GetLocalizedString("RoomMailbox.Text"), "5")); rbMailboxType.Items.Add(new System.Web.UI.WebControls.ListItem(GetLocalizedString("EquipmentMailbox.Text"), "6")); } if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2013_SHAREDMAILBOXES)) { if (cntx.Quotas[Quotas.EXCHANGE2013_SHAREDMAILBOXES].QuotaAllocatedValue != 0) { rbMailboxType.Items.Add(new System.Web.UI.WebControls.ListItem(GetLocalizedString("SharedMailbox.Text"), "10")); } } divRetentionPolicy.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, cntx); } divArchiving.Visible = false; int planId = -1; int.TryParse(mailboxPlanSelector.MailboxPlanId, out planId); ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, planId); if (plan != null) { divArchiving.Visible = plan.EnableArchiving; } }
public int UpdateExchangeMailboxPlan(int itemId, ExchangeMailboxPlan mailboxPlan) { return(ExchangeServerController.UpdateExchangeMailboxPlan(itemId, mailboxPlan)); }
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); } }
private void AddMailboxPlan() { try { ExchangeMailboxPlan plan = new ExchangeMailboxPlan(); plan.MailboxPlan = txtMailboxPlan.Text; plan.Archiving = RetentionPolicy; if (RetentionPolicy) { } else { plan.MailboxSizeMB = mailboxSize.QuotaValue; plan.IsDefault = false; plan.MaxRecipients = maxRecipients.QuotaValue; plan.MaxSendMessageSizeKB = maxSendMessageSizeKB.QuotaValue; plan.MaxReceiveMessageSizeKB = maxReceiveMessageSizeKB.QuotaValue; plan.EnablePOP = chkPOP3.Checked; plan.EnableIMAP = chkIMAP.Checked; plan.EnableOWA = chkOWA.Checked; plan.EnableMAPI = chkMAPI.Checked; plan.EnableActiveSync = chkActiveSync.Checked; plan.EnableAutoReply = chkAutoReplyEnabled.Checked; plan.IssueWarningPct = sizeIssueWarning.ValueKB; if ((plan.IssueWarningPct == 0)) { plan.IssueWarningPct = 100; } plan.ProhibitSendPct = sizeProhibitSend.ValueKB; if ((plan.ProhibitSendPct == 0)) { plan.ProhibitSendPct = 100; } plan.ProhibitSendReceivePct = sizeProhibitSendReceive.ValueKB; if ((plan.ProhibitSendReceivePct == 0)) { plan.ProhibitSendReceivePct = 100; } plan.KeepDeletedItemsDays = daysKeepDeletedItems.ValueDays; plan.HideFromAddressBook = chkHideFromAddressBook.Checked; plan.AllowLitigationHold = chkEnableLitigationHold.Checked; plan.RecoverableItemsSpace = recoverableItemsSpace.QuotaValue; plan.RecoverableItemsWarningPct = recoverableItemsWarning.ValueKB; if ((plan.RecoverableItemsWarningPct == 0)) { plan.RecoverableItemsWarningPct = 100; } plan.LitigationHoldMsg = txtLitigationHoldMsg.Text.Trim(); plan.LitigationHoldUrl = txtLitigationHoldUrl.Text.Trim(); plan.EnableArchiving = chkEnableArchiving.Checked; plan.ArchiveSizeMB = archiveQuota.QuotaValue; plan.ArchiveWarningPct = archiveWarningQuota.ValueKB; if ((plan.ArchiveWarningPct == 0)) { plan.ArchiveWarningPct = 100; } plan.EnableForceArchiveDeletion = chkEnableForceArchiveDeletion.Checked; plan.IsForJournaling = chkIsForJournaling.Checked; } int planId = ES.Services.ExchangeServer.AddExchangeMailboxPlan(PanelRequest.ItemID, plan); if (planId < 0) { messageBox.ShowResultMessage(planId); return; } List <ExchangeMailboxPlanRetentionPolicyTag> tags = ViewState["Tags"] as List <ExchangeMailboxPlanRetentionPolicyTag>; if (tags != null) { foreach (ExchangeMailboxPlanRetentionPolicyTag tag in tags) { tag.MailboxPlanId = planId; IntResult result = ES.Services.ExchangeServer.AddExchangeMailboxPlanRetentionPolicyTag(PanelRequest.ItemID, tag); if (!result.IsSuccess) { messageBox.ShowMessage(result, "EXCHANGE_ADD_MAILBOXPLAN", null); return; } } } Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), RetentionPolicy ? "retentionpolicy" : "mailboxplans", "SpaceID=" + PanelSecurity.PackageId)); } catch (Exception ex) { messageBox.ShowErrorMessage("EXCHANGE_ADD_MAILBOXPLAN", ex); } }