From d5f30bf4933edd590c43075b2aca7b8e660fbc56 Mon Sep 17 00:00:00 2001 From: robvde Date: Sat, 22 Dec 2012 05:01:28 +0400 Subject: [PATCH] partial commit --- .../ExchangeMailboxStatistics.cs | 4 + .../Exchange2007.cs | 2 +- .../Exchange2010.cs | 83 +++++++++++++++++++ .../ExchangeMailboxGeneralSettings.ascx.resx | 9 ++ .../ExchangeMailboxGeneralSettings.ascx | 33 ++++++-- .../ExchangeMailboxGeneralSettings.ascx.cs | 14 ++-- ...ngeMailboxGeneralSettings.ascx.designer.cs | 63 ++++++++++++-- 7 files changed, 186 insertions(+), 22 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeMailboxStatistics.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeMailboxStatistics.cs index 7b408e10..040d55ca 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeMailboxStatistics.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeMailboxStatistics.cs @@ -37,6 +37,7 @@ namespace WebsitePanel.Providers.HostedSolution public string DisplayName{ get; set; } public DateTime AccountCreated { get; set; } public string PrimaryEmailAddress { get; set; } + public bool LitigationHoldEnabled { get; set; } public bool POPEnabled { get; set; } public bool IMAPEnabled { get; set; } public bool OWAEnabled { get; set; } @@ -45,6 +46,9 @@ namespace WebsitePanel.Providers.HostedSolution public int TotalItems { get; set; } public long TotalSize { get; set; } public long MaxSize { get; set; } + public long LitigationHoldTotalSize { get; set; } + public long LitigationHoldTotalItems { get; set; } + public long LitigationHoldMaxSize { get; set; } public DateTime LastLogon { get; set; } public DateTime LastLogoff { get; set; } public bool Enabled { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs index 0080af13..a23552fa 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs @@ -2795,7 +2795,7 @@ namespace WebsitePanel.Providers.HostedSolution return type; } - private ExchangeMailboxStatistics GetMailboxStatisticsInternal(string id) + virtual internal ExchangeMailboxStatistics GetMailboxStatisticsInternal(string id) { ExchangeLog.LogStart("GetMailboxStatisticsInternal"); ExchangeLog.DebugInfo("Account: {0}", id); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010.cs index 65565207..d4a8b7ec 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2010.cs @@ -160,6 +160,89 @@ namespace WebsitePanel.Providers.HostedSolution } + internal override ExchangeMailboxStatistics GetMailboxStatisticsInternal(string id) + { + ExchangeLog.LogStart("GetMailboxStatisticsInternal"); + ExchangeLog.DebugInfo("Account: {0}", id); + + ExchangeMailboxStatistics info = new ExchangeMailboxStatistics(); + Runspace runSpace = null; + try + { + runSpace = OpenRunspace(); + + Collection result = GetMailboxObject(runSpace, id); + PSObject mailbox = result[0]; + + string dn = GetResultObjectDN(result); + string path = AddADPrefix(dn); + DirectoryEntry entry = GetADObject(path); + info.Enabled = !(bool)entry.InvokeGet("AccountDisabled"); + info.LitigationHoldEnabled = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled"); + + info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName"); + SmtpAddress smtpAddress = (SmtpAddress)GetPSObjectProperty(mailbox, "PrimarySmtpAddress"); + if (smtpAddress != null) + info.PrimaryEmailAddress = smtpAddress.ToString(); + + info.MaxSize = ConvertUnlimitedToBytes((Unlimited)GetPSObjectProperty(mailbox, "ProhibitSendReceiveQuota")); + info.LitigationHoldMaxSize = ConvertUnlimitedToBytes((Unlimited)GetPSObjectProperty(mailbox, "RecoverableItemsQuota")); + + DateTime? whenCreated = (DateTime?)GetPSObjectProperty(mailbox, "WhenCreated"); + info.AccountCreated = ConvertNullableToDateTime(whenCreated); + //Client Access + Command cmd = new Command("Get-CASMailbox"); + cmd.Parameters.Add("Identity", id); + result = ExecuteShellCommand(runSpace, cmd); + mailbox = result[0]; + + info.ActiveSyncEnabled = (bool)GetPSObjectProperty(mailbox, "ActiveSyncEnabled"); + info.OWAEnabled = (bool)GetPSObjectProperty(mailbox, "OWAEnabled"); + info.MAPIEnabled = (bool)GetPSObjectProperty(mailbox, "MAPIEnabled"); + info.POPEnabled = (bool)GetPSObjectProperty(mailbox, "PopEnabled"); + info.IMAPEnabled = (bool)GetPSObjectProperty(mailbox, "ImapEnabled"); + + //Statistics + cmd = new Command("Get-MailboxStatistics"); + cmd.Parameters.Add("Identity", id); + result = ExecuteShellCommand(runSpace, cmd); + if (result.Count > 0) + { + PSObject statistics = result[0]; + Unlimited totalItemSize = (Unlimited)GetPSObjectProperty(statistics, "TotalItemSize"); + info.TotalSize = ConvertUnlimitedToBytes(totalItemSize); + + uint? itemCount = (uint?)GetPSObjectProperty(statistics, "ItemCount"); + info.TotalItems = ConvertNullableToInt32(itemCount); + + totalItemSize = (Unlimited)GetPSObjectProperty(statistics, "FolderAndSubfolderSize"); + info.LitigationHoldTotalSize = ConvertUnlimitedToBytes(totalItemSize); + + itemCount = (uint?)GetPSObjectProperty(statistics, "ItemsInFolder"); + info.LitigationHoldTotalItems = ConvertNullableToInt32(itemCount); + + DateTime? lastLogoffTime = (DateTime?)GetPSObjectProperty(statistics, "LastLogoffTime"); + DateTime? lastLogonTime = (DateTime?)GetPSObjectProperty(statistics, "LastLogonTime"); + info.LastLogoff = ConvertNullableToDateTime(lastLogoffTime); + info.LastLogon = ConvertNullableToDateTime(lastLogonTime); + } + else + { + info.TotalSize = 0; + info.TotalItems = 0; + info.LastLogoff = DateTime.MinValue; + info.LastLogon = DateTime.MinValue; + } + } + finally + { + CloseRunspace(runSpace); + } + ExchangeLog.LogEnd("GetMailboxStatisticsInternal"); + return info; + } + + internal override void SetMailboxAdvancedSettingsInternal(string organizationId, string accountName, bool enablePOP, bool enableIMAP, bool enableOWA, bool enableMAPI, bool enableActiveSync, long issueWarningKB, long prohibitSendKB, diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeMailboxGeneralSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeMailboxGeneralSettings.ascx.resx index cb0a8c7b..eac7ac03 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeMailboxGeneralSettings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeMailboxGeneralSettings.ascx.resx @@ -159,4 +159,13 @@ * + + Enable Litigation Hold + + + Litigation Hold Space: + + + Litigation Hold Settings + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx index 848f1310..184d86bc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx @@ -32,9 +32,7 @@ - - + @@ -71,14 +69,35 @@ - - + + + + + + + + + + + + + +
+ +
+
+
+ MB +
+
+
+
+ + -
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs index f2ea7f15..8a8430a4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs @@ -50,8 +50,9 @@ namespace WebsitePanel.Portal.ExchangeServer chkHideAddressBook.Visible = false; chkDisable.Visible = false; } - } + secLitigationHoldSettings.Visible = (Utils.CheckQouta(Quotas.EXCHANGE2007_ALLOWLITIGATIONHOLD, cntx)); + } } } @@ -99,10 +100,13 @@ namespace WebsitePanel.Portal.ExchangeServer mailboxSize.QuotaUsedValue = Convert.ToInt32(stats.TotalSize / 1024 / 1024); mailboxSize.QuotaValue = (stats.MaxSize == -1) ? -1: (int)Math.Round((double)(stats.MaxSize / 1024 / 1024)); - if ((account.AccountType == ExchangeAccountType.Equipment) | (account.AccountType == ExchangeAccountType.Room)) - secCalendarSettings.Visible = true; - else - secCalendarSettings.Visible = false; + secCalendarSettings.Visible = ((account.AccountType == ExchangeAccountType.Equipment) | (account.AccountType == ExchangeAccountType.Room)); + + chkEnableLitigationHold.Checked = mailbox.EnableLitigationHold; + + litigationHoldSpace.QuotaUsedValue = Convert.ToInt32(stats.LitigationHoldTotalSize / 1024 / 1024); + litigationHoldSpace.QuotaValue = (stats.LitigationHoldMaxSize == -1) ? -1 : (int)Math.Round((double)(stats.LitigationHoldMaxSize / 1024 / 1024)); + } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs index d1dc4f60..c7612333 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs @@ -165,6 +165,60 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::WebsitePanel.Portal.QuotaViewer mailboxSize; + /// + /// secLitigationHoldSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secLitigationHoldSettings; + + /// + /// LitigationHoldSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel LitigationHoldSettings; + + /// + /// LitigationHoldUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel LitigationHoldUpdatePanel; + + /// + /// chkEnableLitigationHold control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnableLitigationHold; + + /// + /// locLitigationHoldSpace control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locLitigationHoldSpace; + + /// + /// litigationHoldSpace control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaViewer litigationHoldSpace; + /// /// secCalendarSettings control. /// @@ -218,14 +272,5 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1; - - /// - /// FormComments control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize FormComments; } }