Fix archiving

This commit is contained in:
dev_amdtel 2014-06-10 17:03:26 +04:00
parent d53f450523
commit a17e35e589
7 changed files with 104 additions and 14 deletions

View file

@ -4378,3 +4378,72 @@ WHERE
RETURN RETURN
GO GO
-- Exchange2013 Archiving
ALTER PROCEDURE [dbo].[GetExchangeOrganizationStatistics]
(
@ItemID int
)
AS
DECLARE @ARCHIVESIZE INT
IF -1 in (SELECT B.ArchiveSizeMB FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID)
BEGIN
SET @ARCHIVESIZE = -1
END
ELSE
BEGIN
SET @ARCHIVESIZE = (SELECT SUM(B.ArchiveSizeMB) FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID)
END
IF -1 IN (SELECT B.MailboxSizeMB FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID)
BEGIN
SELECT
(SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 1 OR AccountType = 5 OR AccountType = 6) AND ItemID = @ItemID) AS CreatedMailboxes,
(SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 2 AND ItemID = @ItemID) AS CreatedContacts,
(SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 3 AND ItemID = @ItemID) AS CreatedDistributionLists,
(SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 4 AND ItemID = @ItemID) AS CreatedPublicFolders,
(SELECT COUNT(*) FROM ExchangeOrganizationDomains WHERE ItemID = @ItemID) AS CreatedDomains,
(SELECT MIN(B.MailboxSizeMB) FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID) AS UsedDiskSpace,
(SELECT MIN(B.RecoverableItemsSpace) FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID) AS UsedLitigationHoldSpace,
@ARCHIVESIZE AS UsedArchingStorage
END
ELSE
BEGIN
SELECT
(SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 1 OR AccountType = 5 OR AccountType = 6) AND ItemID = @ItemID) AS CreatedMailboxes,
(SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 2 AND ItemID = @ItemID) AS CreatedContacts,
(SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 3 AND ItemID = @ItemID) AS CreatedDistributionLists,
(SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 4 AND ItemID = @ItemID) AS CreatedPublicFolders,
(SELECT COUNT(*) FROM ExchangeOrganizationDomains WHERE ItemID = @ItemID) AS CreatedDomains,
(SELECT SUM(B.MailboxSizeMB) FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID) AS UsedDiskSpace,
(SELECT SUM(B.RecoverableItemsSpace) FROM ExchangeAccounts AS A INNER JOIN ExchangeMailboxPlans AS B ON A.MailboxPlanId = B.MailboxPlanId WHERE A.ItemID=@ItemID) AS UsedLitigationHoldSpace,
@ARCHIVESIZE AS UsedArchingStorage
END
RETURN
GO
BEGIN
DELETE FROM [dbo].[HostingPlanQuotas] WHERE QuotaID = 427
END
GO
BEGIN
DELETE FROM [dbo].[PackageQuotas] WHERE QuotaID = 427
END
GO
BEGIN
DELETE FROM [dbo].[Quotas] WHERE QuotaID = 427
END
GO

View file

@ -119,9 +119,8 @@ order by rg.groupOrder
public const string EXCHANGE2007_RECOVERABLEITEMSSPACE = "Exchange2007.RecoverableItemsSpace"; public const string EXCHANGE2007_RECOVERABLEITEMSSPACE = "Exchange2007.RecoverableItemsSpace";
public const string EXCHANGE2007_DISCLAIMERSALLOWED = "Exchange2007.DisclaimersAllowed"; public const string EXCHANGE2007_DISCLAIMERSALLOWED = "Exchange2007.DisclaimersAllowed";
public const string EXCHANGE2013_ALLOWARCHIVING = "Exchange2013.AllowArchiving"; public const string EXCHANGE2013_ALLOWRETENTIONPOLICY = "Exchange2013.AllowRetentionPolicy"; // RetentionPolicy
public const string EXCHANGE2013_ALLOWRETENTIONPOLICY = "Exchange2013.AllowRetentionPolicy"; // Archiving public const string EXCHANGE2013_ARCHIVINGSTORAGE = "Exchange2013.ArchivingStorage"; // Archiving
public const string EXCHANGE2013_ARCHIVINGSTORAGE = "Exchange2013.ArchivingStorage";
public const string EXCHANGE2013_ARCHIVINGMAILBOXES = "Exchange2013.ArchivingMailboxes"; public const string EXCHANGE2013_ARCHIVINGMAILBOXES = "Exchange2013.ArchivingMailboxes";
public const string MSSQL2000_DATABASES = "MsSQL2000.Databases"; // Databases public const string MSSQL2000_DATABASES = "MsSQL2000.Databases"; // Databases

View file

@ -192,6 +192,7 @@ namespace WebsitePanel.EnterpriseServer
stats.CreatedPublicFolders = tempStats.CreatedPublicFolders; stats.CreatedPublicFolders = tempStats.CreatedPublicFolders;
stats.UsedDiskSpace = tempStats.UsedDiskSpace; stats.UsedDiskSpace = tempStats.UsedDiskSpace;
stats.UsedLitigationHoldSpace = tempStats.UsedLitigationHoldSpace; stats.UsedLitigationHoldSpace = tempStats.UsedLitigationHoldSpace;
stats.UsedArchingStorage = tempStats.UsedArchingStorage;
} }
else else
{ {
@ -219,6 +220,7 @@ namespace WebsitePanel.EnterpriseServer
stats.CreatedPublicFolders += tempStats.CreatedPublicFolders; stats.CreatedPublicFolders += tempStats.CreatedPublicFolders;
stats.UsedDiskSpace += tempStats.UsedDiskSpace; stats.UsedDiskSpace += tempStats.UsedDiskSpace;
stats.UsedLitigationHoldSpace += tempStats.UsedLitigationHoldSpace; stats.UsedLitigationHoldSpace += tempStats.UsedLitigationHoldSpace;
stats.UsedArchingStorage += tempStats.UsedArchingStorage;
} }
} }
} }
@ -237,6 +239,7 @@ namespace WebsitePanel.EnterpriseServer
stats.AllocatedPublicFolders = cntx.Quotas[Quotas.EXCHANGE2007_PUBLICFOLDERS].QuotaAllocatedValue; stats.AllocatedPublicFolders = cntx.Quotas[Quotas.EXCHANGE2007_PUBLICFOLDERS].QuotaAllocatedValue;
stats.AllocatedDiskSpace = cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue; stats.AllocatedDiskSpace = cntx.Quotas[Quotas.EXCHANGE2007_DISKSPACE].QuotaAllocatedValue;
stats.AllocatedLitigationHoldSpace = cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue; stats.AllocatedLitigationHoldSpace = cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue;
stats.AllocatedArchingStorage = cntx.Quotas[Quotas.EXCHANGE2013_ARCHIVINGSTORAGE].QuotaAllocatedValue;
return stats; return stats;
} }

View file

@ -3079,6 +3079,22 @@ namespace WebsitePanel.Providers.HostedSolution
info.LastLogon = DateTime.MinValue; info.LastLogon = DateTime.MinValue;
} }
cmd = new Command("Get-MailboxStatistics");
cmd.Parameters.Add("Identity", id);
cmd.Parameters.Add("Archive");
result = ExecuteShellCommand(runSpace, cmd);
if (result.Count > 0)
{
PSObject statistics = result[0];
Unlimited<ByteQuantifiedSize> totalItemSize =
(Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(statistics, "TotalItemSize");
info.ArchivingTotalSize = ConvertUnlimitedToBytes(totalItemSize);
}
else
{
info.ArchivingTotalSize = 0;
}
if (info.LitigationHoldEnabled) if (info.LitigationHoldEnabled)
{ {
cmd = new Command("Get-MailboxFolderStatistics"); cmd = new Command("Get-MailboxFolderStatistics");

View file

@ -104,13 +104,13 @@ namespace WebsitePanel.Portal.ExchangeServer
rowRetentionPolicy.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, cntx); rowRetentionPolicy.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, cntx);
} }
rowArchiving.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx); rowArchiving.Visible = false;
int planId = -1; int planId = -1;
int.TryParse(mailboxPlanSelector.MailboxPlanId, out planId); int.TryParse(mailboxPlanSelector.MailboxPlanId, out planId);
ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, planId); ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, planId);
if (plan!=null) if (plan!=null)
rowArchiving.Visible = rowArchiving.Visible && plan.EnableArchiving; rowArchiving.Visible = plan.EnableArchiving;
} }

View file

@ -89,7 +89,7 @@ namespace WebsitePanel.Portal.ExchangeServer
int.TryParse(mailboxPlanSelector.MailboxPlanId, out planId); int.TryParse(mailboxPlanSelector.MailboxPlanId, out planId);
ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, planId); ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, planId);
secArchiving.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, Cntx) && plan.EnableArchiving; secArchiving.Visible = plan.EnableArchiving;
rowArchiving.Visible = chkEnableArchiving.Checked; rowArchiving.Visible = chkEnableArchiving.Checked;
} }
@ -119,6 +119,10 @@ namespace WebsitePanel.Portal.ExchangeServer
// get account meta // get account meta
ExchangeAccount account = ES.Services.ExchangeServer.GetAccount(PanelRequest.ItemID, PanelRequest.AccountID); 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; chkPmmAllowed.Checked = (account.MailboxManagerActions & MailboxManagerActions.GeneralSettings) > 0;
if (account.MailboxPlanId == 0) if (account.MailboxPlanId == 0)
@ -156,12 +160,11 @@ namespace WebsitePanel.Portal.ExchangeServer
ddDisclaimer.SelectedValue = disclaimerId.ToString(); ddDisclaimer.SelectedValue = disclaimerId.ToString();
} }
if (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, Cntx)) int ArchivingMaxSize = -1;
{ if (plan != null) ArchivingMaxSize = plan.ArchiveSizeMB;
chkEnableArchiving.Checked = account.EnableArchiving; chkEnableArchiving.Checked = account.EnableArchiving;
archivingQuotaViewer.QuotaUsedValue = Convert.ToInt32(stats.ArchivingTotalSize / 1024 / 1024); archivingQuotaViewer.QuotaUsedValue = Convert.ToInt32(stats.ArchivingTotalSize / 1024 / 1024);
archivingQuotaViewer.QuotaValue = (stats.ArchivingMaxSize == -1) ? -1 : (int)Math.Round((double)(stats.ArchivingMaxSize / 1024 / 1024)); archivingQuotaViewer.QuotaValue = ArchivingMaxSize;
}
} }
catch (Exception ex) catch (Exception ex)

View file

@ -123,13 +123,13 @@ namespace WebsitePanel.Portal.ExchangeServer
else else
this.rowExchangeLitigationHold.Style.Add("display", "none"); this.rowExchangeLitigationHold.Style.Add("display", "none");
if ((!hideItems) && (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx))) if (!hideItems)
{ {
exchangeArchivingStatus.QuotaUsedValue = exchangeOrgStats.UsedArchingStorage; exchangeArchivingStatus.QuotaUsedValue = exchangeOrgStats.UsedArchingStorage;
exchangeArchivingStatus.QuotaValue = exchangeOrgStats.AllocatedArchingStorage; exchangeArchivingStatus.QuotaValue = exchangeOrgStats.AllocatedArchingStorage;
if (exchangeOrgStats.AllocatedArchingStorage != -1) if (exchangeOrgStats.AllocatedArchingStorage != -1)
{ {
exchangeLitigationHoldStats.QuotaAvailable = exchangeTenantStats.AllocatedArchingStorage - exchangeTenantStats.UsedArchingStorage; exchangeArchivingStatus.QuotaAvailable = exchangeTenantStats.AllocatedArchingStorage - exchangeTenantStats.UsedArchingStorage;
} }
} }
else else