Fix archiving

This commit is contained in:
dev_amdtel 2014-05-16 18:33:08 +04:00
parent 56cf823559
commit b820a28f85
15 changed files with 209 additions and 77 deletions

View file

@ -574,7 +574,7 @@ namespace WebsitePanel.Import.CsvBulk
//create mailbox
//ES.Services.ExchangeServer.
string accountName = string.Empty;
int accountId = ES.Services.ExchangeServer.CreateMailbox(orgId, 0, ExchangeAccountType.Mailbox, accountName, displayName, name, domain, password, false, string.Empty, planId, -1, string.Empty);
int accountId = ES.Services.ExchangeServer.CreateMailbox(orgId, 0, ExchangeAccountType.Mailbox, accountName, displayName, name, domain, password, false, string.Empty, planId, -1, string.Empty, false);
if (accountId < 0)
{
string errorMessage = GetErrorMessage(accountId);

View file

@ -973,7 +973,7 @@ namespace WebsitePanel.Import.Enterprise
mailEnabledPublicFolder,
mailboxManagerActions,
samAccountName,
CryptoUtils.Encrypt(accountPassword), 0, -1, string.Empty);
CryptoUtils.Encrypt(accountPassword), 0, -1, string.Empty, false);
}
}
}

View file

@ -1737,10 +1737,10 @@ namespace WebsitePanel.EnterpriseServer
if (maxArchivingStorage != -1)
{
if (plan.MailboxSizeMB == -1)
if (plan.ArchiveSizeMB == -1)
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
if ((quotaArchivingStorageUsed + plan.MailboxSizeMB) > (maxArchivingStorage))
if ((quotaArchivingStorageUsed + plan.ArchiveSizeMB) > (maxArchivingStorage))
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
}
@ -3068,15 +3068,6 @@ namespace WebsitePanel.EnterpriseServer
ExchangeMailboxPlan retentionPolicy = GetExchangeMailboxPlan(itemId, retentionPolicyId);
if (retentionPolicy != null)
{
// update PlanRetentionPolicy and Tags
List<ExchangeMailboxPlanRetentionPolicyTag> listtags = GetExchangeMailboxPlanRetentionPolicyTags(retentionPolicyId);
foreach(ExchangeMailboxPlanRetentionPolicyTag listtag in listtags)
{
ExchangeRetentionPolicyTag tag = GetExchangeRetentionPolicyTag(itemId, listtag.TagID);
ResultObject resItem = exchange.SetRetentionPolicyTag(tag.WSPUniqueName, (ExchangeRetentionPolicyTagType)tag.TagType, tag.AgeLimitForRetention, (ExchangeRetentionPolicyTagAction)tag.RetentionAction);
result.ErrorCodes.AddRange(resItem.ErrorCodes);
result.IsSuccess = result.IsSuccess && resItem.IsSuccess;
}
UpdateExchangeRetentionPolicy(itemId, retentionPolicyId, result);
}
@ -3369,18 +3360,6 @@ namespace WebsitePanel.EnterpriseServer
private static void UpdateExchangeRetentionPolicy(int itemID, int policyId, ResultObject result)
{
ExchangeMailboxPlan policy = GetExchangeMailboxPlan(itemID, policyId);
List<ExchangeMailboxPlanRetentionPolicyTag> policytaglist = GetExchangeMailboxPlanRetentionPolicyTags(policyId);
List<string> tagLinks = new List<string>();
foreach (ExchangeMailboxPlanRetentionPolicyTag policytag in policytaglist)
{
ExchangeRetentionPolicyTag tag = GetExchangeRetentionPolicyTag(itemID, policytag.TagID);
tagLinks.Add(tag.WSPUniqueName);
}
Organization org = GetOrganization(itemID);
if (org == null)
return;
@ -3391,11 +3370,29 @@ namespace WebsitePanel.EnterpriseServer
{
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
ExchangeMailboxPlan policy = GetExchangeMailboxPlan(itemID, policyId);
List<ExchangeMailboxPlanRetentionPolicyTag> policytaglist = GetExchangeMailboxPlanRetentionPolicyTags(policyId);
List<string> tagLinks = new List<string>();
foreach (ExchangeMailboxPlanRetentionPolicyTag policytag in policytaglist)
{
ExchangeRetentionPolicyTag tag = GetExchangeRetentionPolicyTag(itemID, policytag.TagID);
tagLinks.Add(tag.WSPUniqueName);
// update PlanRetentionPolicyTags
ResultObject resItem = exchange.SetRetentionPolicyTag(tag.WSPUniqueName, (ExchangeRetentionPolicyTagType)tag.TagType, tag.AgeLimitForRetention, (ExchangeRetentionPolicyTagAction)tag.RetentionAction);
result.ErrorCodes.AddRange(resItem.ErrorCodes);
result.IsSuccess = result.IsSuccess && resItem.IsSuccess;
}
ResultObject res = exchange.SetRetentionPolicy(policy.WSPUniqueName, tagLinks.ToArray());
result.ErrorCodes.AddRange(res.ErrorCodes);
result.IsSuccess = result.IsSuccess && res.IsSuccess;
}
}
}
public static IntResult AddExchangeMailboxPlanRetentionPolicyTag(int itemID, ExchangeMailboxPlanRetentionPolicyTag planTag)

View file

@ -327,6 +327,20 @@ namespace WebsitePanel.Providers.HostedSolution
get { return createdGroups; }
set { createdGroups = value; }
}
int allocatedArchingStorage;
public int AllocatedArchingStorage
{
get { return allocatedArchingStorage; }
set { allocatedArchingStorage = value; }
}
int usedArchingStorage;
public int UsedArchingStorage
{
get { return usedArchingStorage; }
set { usedArchingStorage = value; }
}
}
}

View file

@ -5452,4 +5452,85 @@
<data name="Quota.Exchange2013.ArchivingMailboxes" xml:space="preserve">
<value>Archiving Mailboxes per Organization</value>
</data>
<data name="Quota.Exchange2013.AllowArchiving" xml:space="preserve">
<value>Allow Archiving</value>
</data>
<data name="Text.All" xml:space="preserve">
<value>All</value>
</data>
<data name="Text.Calendar" xml:space="preserve">
<value>Calendar</value>
</data>
<data name="Text.Contacts" xml:space="preserve">
<value>Contacts</value>
</data>
<data name="Text.ConversationHistory" xml:space="preserve">
<value>Conversation History</value>
</data>
<data name="Text.DeleteAndAllowRecovery" xml:space="preserve">
<value>Delete and Allow Recovery</value>
</data>
<data name="Text.DeletedItems" xml:space="preserve">
<value>Deleted Items</value>
</data>
<data name="Text.Drafts" xml:space="preserve">
<value>Drafts</value>
</data>
<data name="Text.Inbox" xml:space="preserve">
<value>Inbox</value>
</data>
<data name="Text.Journal" xml:space="preserve">
<value>Journal</value>
</data>
<data name="Text.JunkEmail" xml:space="preserve">
<value>Junk Email</value>
</data>
<data name="Text.LegacyArchiveJournals" xml:space="preserve">
<value>Legacy Archive Journals</value>
</data>
<data name="Text.ManagedCustomFolder" xml:space="preserve">
<value>Managed Custom Folder</value>
</data>
<data name="Text.MarkAsPastRetentionLimit" xml:space="preserve">
<value>Mark as Past Retention Limit</value>
</data>
<data name="Text.MoveToArchive" xml:space="preserve">
<value>Move to Archive</value>
</data>
<data name="Text.MoveToDeletedItems" xml:space="preserve">
<value>Move to Deleted</value>
</data>
<data name="Text.MoveToFolder" xml:space="preserve">
<value>Move to Folder</value>
</data>
<data name="Text.NonIpmRoot" xml:space="preserve">
<value>Non Ipm Root</value>
</data>
<data name="Text.Notes" xml:space="preserve">
<value>Notes</value>
</data>
<data name="Text.Outbox" xml:space="preserve">
<value>Outbox</value>
</data>
<data name="Text.PermanentlyDelete" xml:space="preserve">
<value>Permanently Delete</value>
</data>
<data name="Text.Personal" xml:space="preserve">
<value>Personal</value>
</data>
<data name="Text.RecoverableItems" xml:space="preserve">
<value>Recoverable Items</value>
</data>
<data name="Text.RssSubscriptions" xml:space="preserve">
<value>Rss Subscriptions</value>
</data>
<data name="Text.SentItems" xml:space="preserve">
<value>Sent Items</value>
</data>
<data name="Text.SyncIssues" xml:space="preserve">
<value>Sync Issues</value>
</data>
<data name="Text.Tasks" xml:space="preserve">
<value>Tasks</value>
</data>
</root>

View file

@ -288,7 +288,7 @@
<br />
<div class="FormFooterClean">
<asp:Button id="btnAdd" runat="server" Text="Add Mailboxplan" CssClass="Button1" meta:resourcekey="btnAdd" ValidationGroup="CreateMailboxPlan" OnClick="btnAdd_Click" OnClientClick="ShowProgressDialog('Creating ...');"></asp:Button>
<asp:Button id="btnAdd" runat="server" Text="Add" CssClass="Button1" meta:resourcekey="btnAdd" ValidationGroup="CreateMailboxPlan" OnClick="btnAdd_Click" OnClientClick="ShowProgressDialog('Creating ...');"></asp:Button>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="CreateMailboxPlan" />
</div>
</div>

View file

@ -138,7 +138,7 @@
<asp:Localize ID="locMailboxplanName" runat="server" meta:resourcekey="locMailboxplanName" Text="Mailboxplan Name: *"></asp:Localize>
</td>
<td>
<wsp:MailboxPlanSelector ID="mailboxPlanSelector" runat="server" Archiving="false" />
<wsp:MailboxPlanSelector ID="mailboxPlanSelector" runat="server" Archiving="false" OnChanged="mailboxPlanSelector_Change" />
</td>
</tr>
<tr id="rowRetentionPolicy" runat="server">

View file

@ -45,6 +45,8 @@ namespace WebsitePanel.Portal.ExchangeServer
protected void Page_Load(object sender, EventArgs e)
{
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (!IsPostBack)
{
password.SetPackagePolicy(PanelSecurity.PackageId, UserSettings.EXCHANGE_POLICY, "MailboxPasswordPolicy");
@ -89,7 +91,6 @@ namespace WebsitePanel.Portal.ExchangeServer
if (plans.Length == 0)
btnCreate.Enabled = false;
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER))
{
if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1)
@ -101,9 +102,16 @@ namespace WebsitePanel.Portal.ExchangeServer
}
rowRetentionPolicy.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, cntx);
rowArchiving.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx);
}
rowArchiving.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx);
int planId = -1;
int.TryParse(mailboxPlanSelector.MailboxPlanId, out planId);
ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, planId);
if (plan!=null)
rowArchiving.Visible = rowArchiving.Visible && plan.EnableArchiving;
}
protected void btnCreate_Click(object sender, EventArgs e)
@ -223,5 +231,9 @@ namespace WebsitePanel.Portal.ExchangeServer
}
protected void mailboxPlanSelector_Change(object sender, EventArgs e)
{
}
}
}

View file

@ -81,7 +81,7 @@ namespace WebsitePanel.Portal.ExchangeServer
secLitigationHoldSettings.Visible = (Utils.CheckQouta(Quotas.EXCHANGE2007_ALLOWLITIGATIONHOLD, Cntx));
}
secRetentionPolicy.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, cntx);
secRetentionPolicy.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, Cntx);
}
@ -89,7 +89,7 @@ namespace WebsitePanel.Portal.ExchangeServer
int.TryParse(mailboxPlanSelector.MailboxPlanId, out planId);
ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, planId);
secArchiving.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx) && plan.EnableArchiving;
secArchiving.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, Cntx) && plan.EnableArchiving;
rowArchiving.Visible = chkEnableArchiving.Checked;
}

View file

@ -65,13 +65,19 @@ namespace WebsitePanel.Portal.ExchangeServer
ddTagType.Items.Clear();
for (int i = 0; i < types.Length; i++)
ddTagType.Items.Add(new ListItem(types[i], i.ToString()));
{
string name = GetSharedLocalizedString("Text."+ types[i]);
ddTagType.Items.Add(new ListItem(name, i.ToString()));
}
string[] action = Enum.GetNames(typeof(ExchangeRetentionPolicyTagAction));
ddRetentionAction.Items.Clear();
for (int i = 0; i < action.Length; i++)
ddRetentionAction.Items.Add(new ListItem(action[i], i.ToString()));
{
string name = GetSharedLocalizedString("Text."+action[i]);
ddRetentionAction.Items.Add(new ListItem(name, i.ToString()));
}
ClearEditValues();
}

View file

@ -129,6 +129,14 @@
<wsp:QuotaViewer ID="exchangeLitigationHoldStats" QuotaTypeId="2" runat="server" DisplayGauge="true" />
</td>
</tr>
<tr class="OrgStatsRow" id="rowExchangeArchiving" runat="server">
<td class="OrgStatsQuota" nowrap>
<asp:HyperLink ID="lnkExchangeArchiving" runat="server" meta:resourcekey="lnkExchangeArchiving">Archiving Storage (Mb):</asp:HyperLink>
</td>
<td>
<wsp:QuotaViewer ID="exchangeArchivingStatus" QuotaTypeId="2" runat="server" DisplayGauge="true" />
</td>
</tr>
</asp:Panel>

View file

@ -66,6 +66,9 @@ namespace WebsitePanel.Portal.ExchangeServer
lnkExchangeLitigationHold.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "storage_usage",
"SpaceID=" + PanelSecurity.PackageId.ToString());
lnkExchangeArchiving.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "archivingmailboxes",
"SpaceID=" + PanelSecurity.PackageId.ToString());
mailboxesStats.QuotaUsedValue = exchangeOrgStats.CreatedMailboxes;
mailboxesStats.QuotaValue = exchangeOrgStats.AllocatedMailboxes;
@ -120,6 +123,18 @@ namespace WebsitePanel.Portal.ExchangeServer
else
this.rowExchangeLitigationHold.Style.Add("display", "none");
if ((!hideItems) && (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx)))
{
exchangeArchivingStatus.QuotaUsedValue = exchangeOrgStats.UsedArchingStorage;
exchangeArchivingStatus.QuotaValue = exchangeOrgStats.AllocatedArchingStorage;
if (exchangeOrgStats.AllocatedArchingStorage != -1)
{
exchangeLitigationHoldStats.QuotaAvailable = exchangeTenantStats.AllocatedArchingStorage - exchangeTenantStats.UsedArchingStorage;
}
}
else
this.rowExchangeArchiving.Style.Add("display", "none");
}
private void BindOrgStats()

View file

@ -1,31 +1,3 @@
// Copyright (c) 2014, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -364,6 +336,33 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer exchangeLitigationHoldStats;
/// <summary>
/// rowExchangeArchiving control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow rowExchangeArchiving;
/// <summary>
/// lnkExchangeArchiving control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink lnkExchangeArchiving;
/// <summary>
/// exchangeArchivingStatus control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer exchangeArchivingStatus;
/// <summary>
/// besStatsPanel control.
/// </summary>

View file

@ -133,8 +133,7 @@
<uc1:QuotaEditor id="mailboxSize" runat="server"
QuotaTypeID="2"
QuotaValue="0"
ParentQuotaValue="-1">
</uc1:QuotaEditor>
ParentQuotaValue="-1"></uc1:QuotaEditor>
</div>
</td>
</tr>
@ -145,8 +144,7 @@
<uc1:QuotaEditor id="maxRecipients" runat="server"
QuotaTypeID="2"
QuotaValue="0"
ParentQuotaValue="-1">
</uc1:QuotaEditor>
ParentQuotaValue="-1"></uc1:QuotaEditor>
</div>
</td>
</tr>
@ -157,8 +155,7 @@
<uc1:QuotaEditor id="maxSendMessageSizeKB" runat="server"
QuotaTypeID="2"
QuotaValue="0"
ParentQuotaValue="-1">
</uc1:QuotaEditor>
ParentQuotaValue="-1"></uc1:QuotaEditor>
</div>
</td>
</tr>
@ -169,8 +166,7 @@
<uc1:QuotaEditor id="maxReceiveMessageSizeKB" runat="server"
QuotaTypeID="2"
QuotaValue="0"
ParentQuotaValue="-1">
</uc1:QuotaEditor>
ParentQuotaValue="-1"></uc1:QuotaEditor>
</div>
</td>
</tr>
@ -231,8 +227,7 @@
<uc1:QuotaEditor id="recoverableItemsSpace" runat="server"
QuotaTypeID="2"
QuotaValue="0"
ParentQuotaValue="-1">
</uc1:QuotaEditor>
ParentQuotaValue="-1"></uc1:QuotaEditor>
</td>
</tr>
<tr>
@ -266,15 +261,14 @@
</td>
<td></td>
</tr>
<tr>
<tr id="rowArchiving">
<td class="FormLabel200" align="right"><asp:Localize ID="locArchiveQuota" runat="server" meta:resourcekey="locArchiveQuota" Text="Archive quota:"></asp:Localize></td>
<td>
<div class="Right">
<uc1:QuotaEditor id="archiveQuota" runat="server"
QuotaTypeID="2"
QuotaValue="0"
ParentQuotaValue="-1">
</uc1:QuotaEditor>
ParentQuotaValue="-1"></uc1:QuotaEditor>
</div>
</td>
</tr>

View file

@ -65,13 +65,19 @@ namespace WebsitePanel.Portal
ddTagType.Items.Clear();
for (int i = 0; i < types.Length; i++)
ddTagType.Items.Add(new ListItem(types[i], i.ToString()));
{
string name = GetSharedLocalizedString("Text." +types[i]);
ddTagType.Items.Add(new ListItem(name, i.ToString()));
}
string[] action = Enum.GetNames(typeof(ExchangeRetentionPolicyTagAction));
ddRetentionAction.Items.Clear();
for (int i = 0; i < action.Length; i++)
ddRetentionAction.Items.Add(new ListItem(action[i], i.ToString()));
{
string name = GetSharedLocalizedString("Text."+action[i]);
ddRetentionAction.Items.Add(new ListItem(name, i.ToString()));
}
txtStatus.Visible = false;
}