Exchange archiving

This commit is contained in:
dev_amdtel 2014-04-14 23:12:27 +04:00
parent 5f951183e3
commit 7755217dfb
21 changed files with 1485 additions and 265 deletions

View file

@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using WebsitePanel.Providers;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.ResultObjects;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -36,16 +40,10 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using WebsitePanel.Providers;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.ResultObjects;
// //
// This source code was auto-generated by wsdl, Version=2.0.50727.42. // This source code was auto-generated by wsdl, Version=2.0.50727.42.
// //
namespace WebsitePanel.EnterpriseServer namespace WebsitePanel.EnterpriseServer {
{
using System.Xml.Serialization; using System.Xml.Serialization;
using System.Web.Services; using System.Web.Services;
using System.ComponentModel; using System.ComponentModel;
@ -1270,17 +1268,19 @@ namespace WebsitePanel.EnterpriseServer
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteExchangeMailboxPlanRetentionPo" + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteExchangeMailboxPlanRetentionPo" +
"licyTag", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] "licyTag", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int DeleteExchangeMailboxPlanRetentionPolicyTag(int itemId, int planTagId) { public int DeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int policyId, int planTagId) {
object[] results = this.Invoke("DeleteExchangeMailboxPlanRetentionPolicyTag", new object[] { object[] results = this.Invoke("DeleteExchangeMailboxPlanRetentionPolicyTag", new object[] {
itemId, itemID,
policyId,
planTagId}); planTagId});
return ((int)(results[0])); return ((int)(results[0]));
} }
/// <remarks/> /// <remarks/>
public System.IAsyncResult BeginDeleteExchangeMailboxPlanRetentionPolicyTag(int itemId, int planTagId, System.AsyncCallback callback, object asyncState) { public System.IAsyncResult BeginDeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int policyId, int planTagId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("DeleteExchangeMailboxPlanRetentionPolicyTag", new object[] { return this.BeginInvoke("DeleteExchangeMailboxPlanRetentionPolicyTag", new object[] {
itemId, itemID,
policyId,
planTagId}, callback, asyncState); planTagId}, callback, asyncState);
} }
@ -1291,17 +1291,18 @@ namespace WebsitePanel.EnterpriseServer
} }
/// <remarks/> /// <remarks/>
public void DeleteExchangeMailboxPlanRetentionPolicyTagAsync(int itemId, int planTagId) { public void DeleteExchangeMailboxPlanRetentionPolicyTagAsync(int itemID, int policyId, int planTagId) {
this.DeleteExchangeMailboxPlanRetentionPolicyTagAsync(itemId, planTagId, null); this.DeleteExchangeMailboxPlanRetentionPolicyTagAsync(itemID, policyId, planTagId, null);
} }
/// <remarks/> /// <remarks/>
public void DeleteExchangeMailboxPlanRetentionPolicyTagAsync(int itemId, int planTagId, object userState) { public void DeleteExchangeMailboxPlanRetentionPolicyTagAsync(int itemID, int policyId, int planTagId, object userState) {
if ((this.DeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted == null)) { if ((this.DeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted == null)) {
this.DeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted); this.DeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted);
} }
this.InvokeAsync("DeleteExchangeMailboxPlanRetentionPolicyTag", new object[] { this.InvokeAsync("DeleteExchangeMailboxPlanRetentionPolicyTag", new object[] {
itemId, itemID,
policyId,
planTagId}, this.DeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted, userState); planTagId}, this.DeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted, userState);
} }

View file

@ -1758,7 +1758,7 @@ namespace WebsitePanel.EnterpriseServer
UpdateExchangeAccount(accountId, accountName, accountType, displayName, email, false, pmmActions.ToString(), samAccount, password, mailboxPlanId, archivedPlanId, subscriberNumber); UpdateExchangeAccount(accountId, accountName, accountType, displayName, email, false, pmmActions.ToString(), samAccount, password, mailboxPlanId, archivedPlanId, subscriberNumber);
SetMailBoxRetentionPolicy(itemId, archivedPlanId, accountName, exchange, org.OrganizationId);
// send setup instructions // send setup instructions
if (sendSetupInstructions) if (sendSetupInstructions)
@ -2595,7 +2595,6 @@ namespace WebsitePanel.EnterpriseServer
} }
#endregion #endregion
@ -2701,6 +2700,8 @@ namespace WebsitePanel.EnterpriseServer
plan.LitigationHoldUrl, plan.LitigationHoldUrl,
plan.LitigationHoldMsg); plan.LitigationHoldMsg);
SetMailBoxRetentionPolicy(itemId, archivePlanId, account.UserPrincipalName, exchange, org.OrganizationId);
DataProvider.SetExchangeAccountMailboxPlan(accountId, mailboxPlanId, archivePlanId); DataProvider.SetExchangeAccountMailboxPlan(accountId, mailboxPlanId, archivePlanId);
return 0; return 0;
@ -3015,6 +3016,36 @@ namespace WebsitePanel.EnterpriseServer
#region Exchange Retention Policy Tags #region Exchange Retention Policy Tags
private static void SetMailBoxRetentionPolicy(int itemId, int retentionPolicyId, string accountName, ExchangeServer exchange, string orgId)
{
bool archive = false;
long archiveQuotaKB = 0;
long archiveWarningQuotaKB = 0;
string RetentionPolicy = "";
if (retentionPolicyId > 0)
{
ExchangeMailboxPlan retentionPolicy = GetExchangeMailboxPlan(itemId, retentionPolicyId);
if (retentionPolicy != null)
{
archive = retentionPolicy.EnableArchiving;
archiveQuotaKB = retentionPolicy.MailboxSizeMB != -1 ? ((long)retentionPolicy.MailboxSizeMB * 1024) : -1;
archiveWarningQuotaKB = retentionPolicy.MailboxSizeMB != -1 ? (((long)retentionPolicy.IssueWarningPct * (long)retentionPolicy.MailboxSizeMB * 1024) / 100) : -1;
// update
List<ExchangeMailboxPlanRetentionPolicyTag> listtags = GetExchangeMailboxPlanRetentionPolicyTags(retentionPolicyId);
foreach(ExchangeMailboxPlanRetentionPolicyTag listtag in listtags)
{
ExchangeRetentionPolicyTag tag = GetExchangeRetentionPolicyTag(itemId, listtag.TagID);
exchange.SetRetentionPolicyTag(tag.WSPUniqueName, (ExchangeRetentionPolicyTagType)tag.TagType, tag.AgeLimitForRetention, (ExchangeRetentionPolicyTagAction)tag.RetentionAction);
}
UpdateExchangeMailboxPlanRetentionPolicyTags(itemId, retentionPolicyId);
}
}
exchange.SetMailBoxArchiving(orgId, accountName, archive, archiveQuotaKB, archiveWarningQuotaKB, RetentionPolicy);
}
public static List<ExchangeRetentionPolicyTag> GetExchangeRetentionPolicyTags(int itemId) public static List<ExchangeRetentionPolicyTag> GetExchangeRetentionPolicyTags(int itemId)
{ {
// place log record // place log record
@ -3124,6 +3155,15 @@ namespace WebsitePanel.EnterpriseServer
// quotas // quotas
} }
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
if (exchangeServiceId > 0)
{
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetRetentionPolicyTag(tag.WSPUniqueName, (ExchangeRetentionPolicyTagType)tag.TagType, tag.AgeLimitForRetention, (ExchangeRetentionPolicyTagAction)tag.RetentionAction);
}
return DataProvider.AddExchangeRetentionPolicyTag(itemID, tag.TagName, tag.TagType, tag.AgeLimitForRetention, tag.RetentionAction ); return DataProvider.AddExchangeRetentionPolicyTag(itemID, tag.TagName, tag.TagType, tag.AgeLimitForRetention, tag.RetentionAction );
} }
catch (Exception ex) catch (Exception ex)
@ -3156,6 +3196,15 @@ namespace WebsitePanel.EnterpriseServer
// quotas // quotas
} }
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
if (exchangeServiceId > 0)
{
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetRetentionPolicyTag(tag.WSPUniqueName, (ExchangeRetentionPolicyTagType)tag.TagType, tag.AgeLimitForRetention, (ExchangeRetentionPolicyTagAction)tag.RetentionAction);
}
DataProvider.UpdateExchangeRetentionPolicyTag(tag.TagID, tag.ItemID, tag.TagName, tag.TagType, tag.AgeLimitForRetention, tag.RetentionAction); DataProvider.UpdateExchangeRetentionPolicyTag(tag.TagID, tag.ItemID, tag.TagName, tag.TagType, tag.AgeLimitForRetention, tag.RetentionAction);
} }
catch (Exception ex) catch (Exception ex)
@ -3177,6 +3226,21 @@ namespace WebsitePanel.EnterpriseServer
try try
{ {
Organization org = GetOrganization(itemID);
if (org == null)
return -1;
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
if (exchangeServiceId > 0)
{
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
ExchangeRetentionPolicyTag tag = GetExchangeRetentionPolicyTag(itemID, tagId);
if (tag == null) return -1;
exchange.RemoveRetentionPolicyTag(tag.WSPUniqueName);
}
DataProvider.DeleteExchangeRetentionPolicyTag(tagId); DataProvider.DeleteExchangeRetentionPolicyTag(tagId);
return 0; return 0;
@ -3215,6 +3279,36 @@ namespace WebsitePanel.EnterpriseServer
} }
} }
private static void UpdateExchangeMailboxPlanRetentionPolicyTags(int itemID, int policyId)
{
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;
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
if (exchangeServiceId > 0)
{
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetRetentionPolicy(policy.WSPUniqueName, tagLinks.ToArray());
}
}
public static int AddExchangeMailboxPlanRetentionPolicyTag(int itemID, ExchangeMailboxPlanRetentionPolicyTag planTag) public static int AddExchangeMailboxPlanRetentionPolicyTag(int itemID, ExchangeMailboxPlanRetentionPolicyTag planTag)
{ {
// place log record // place log record
@ -3234,7 +3328,11 @@ namespace WebsitePanel.EnterpriseServer
// quotas // quotas
} }
return DataProvider.AddExchangeMailboxPlanRetentionPolicyTag(planTag.TagID, planTag.MailboxPlanId); int res = DataProvider.AddExchangeMailboxPlanRetentionPolicyTag(planTag.TagID, planTag.MailboxPlanId);
UpdateExchangeMailboxPlanRetentionPolicyTags(itemID, planTag.MailboxPlanId);
return res;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -3247,7 +3345,7 @@ namespace WebsitePanel.EnterpriseServer
} }
public static int DeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int planTagId) public static int DeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int policyId, int planTagId)
{ {
TaskManager.StartTask("EXCHANGE", "DELETE_EXCHANGE_RETENTIONPOLICYTAG", itemID); TaskManager.StartTask("EXCHANGE", "DELETE_EXCHANGE_RETENTIONPOLICYTAG", itemID);
@ -3255,6 +3353,8 @@ namespace WebsitePanel.EnterpriseServer
{ {
DataProvider.DeleteExchangeMailboxPlanRetentionPolicyTag(planTagId); DataProvider.DeleteExchangeMailboxPlanRetentionPolicyTag(planTagId);
UpdateExchangeMailboxPlanRetentionPolicyTags(itemID, policyId);
return 0; return 0;
} }
catch (Exception ex) catch (Exception ex)

View file

@ -610,9 +610,9 @@ namespace WebsitePanel.EnterpriseServer
} }
[WebMethod] [WebMethod]
public int DeleteExchangeMailboxPlanRetentionPolicyTag(int itemId, int planTagId) public int DeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int policyId, int planTagId)
{ {
return ExchangeServerController.DeleteExchangeMailboxPlanRetentionPolicyTag(itemId, planTagId); return ExchangeServerController.DeleteExchangeMailboxPlanRetentionPolicyTag(itemID, policyId, planTagId);
} }
#endregion #endregion

View file

@ -29,6 +29,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
namespace WebsitePanel.Providers.HostedSolution namespace WebsitePanel.Providers.HostedSolution
{ {
@ -223,5 +224,14 @@ namespace WebsitePanel.Providers.HostedSolution
get { return this.enableArchiving; } get { return this.enableArchiving; }
set { this.enableArchiving = value; } set { this.enableArchiving = value; }
} }
public string WSPUniqueName
{
get
{
Regex r = new Regex(@"[^A-Za-z0-9]");
return "WSPPolicy" + MailboxPlanId.ToString() + "_" + r.Replace(MailboxPlan, "");
}
}
} }
} }

View file

@ -29,6 +29,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
namespace WebsitePanel.Providers.HostedSolution namespace WebsitePanel.Providers.HostedSolution
{ {
@ -76,5 +77,13 @@ namespace WebsitePanel.Providers.HostedSolution
set { retentionAction = value; } set { retentionAction = value; }
} }
public string WSPUniqueName
{
get
{
Regex r = new Regex(@"[^A-Za-z0-9]");
return "WSPPolicyTag" + TagID.ToString() + "_" + r.Replace(TagName, "");
}
}
} }
} }

View file

@ -130,5 +130,14 @@ namespace WebsitePanel.Providers.HostedSolution
// Disclaimers // Disclaimers
int NewDisclaimerTransportRule(string Name, string From, string Text); int NewDisclaimerTransportRule(string Name, string From, string Text);
int RemoveTransportRule(string Name); int RemoveTransportRule(string Name);
// Archiving
void SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy);
// Retention policy
void SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction);
void RemoveRetentionPolicyTag(string Identity);
void SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks);
void RemoveRetentionPolicy(string Identity);
} }
} }

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012, Outercurve Foundation. // Copyright (c) 2012-2014, Outercurve Foundation.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
@ -96,6 +96,11 @@ namespace WebsitePanel.Providers.HostedSolution
get { return ProviderSettings["MailboxDatabase"]; } get { return ProviderSettings["MailboxDatabase"]; }
} }
internal string ArchiveMailboxDatabase
{
get { return ProviderSettings["ArchivingDatabase"]; }
}
internal bool PublicFolderDistributionEnabled internal bool PublicFolderDistributionEnabled
{ {
get { return ProviderSettings.GetBool("PublicFolderDistributionEnabled"); } get { return ProviderSettings.GetBool("PublicFolderDistributionEnabled"); }
@ -7246,6 +7251,248 @@ namespace WebsitePanel.Providers.HostedSolution
} }
#endregion #endregion
#region Archiving
public void SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
{
SetMailBoxArchivingInternal(organizationId, accountName, archive, archiveQuotaKB, archiveWarningQuotaKB, RetentionPolicy);
}
private void SetMailBoxArchivingInternal(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
{
ExchangeLog.LogStart("SetMailBoxArchivingInternal");
ExchangeLog.DebugInfo("Account: {0}", accountName);
Runspace runSpace = null;
Runspace runSpaceEx = null;
try
{
runSpace = OpenRunspace();
runSpaceEx = OpenRunspaceEx();
Command cmd;
if (archive)
{
cmd = new Command("Enable-Mailbox");
cmd.Parameters.Add("Identity", accountName);
cmd.Parameters.Add("Archive");
string database = GetDatabase(runSpace, PrimaryDomainController, ArchiveMailboxDatabase);
ExchangeLog.DebugInfo("archivedatabase: " + database);
if (database != string.Empty)
{
cmd.Parameters.Add("ArchiveDatabase", database);
}
ExecuteShellCommand(runSpace, cmd);
cmd = new Command("Set-Mailbox");
cmd.Parameters.Add("Identity", accountName);
cmd.Parameters.Add("ArchiveQuota", ConvertKBToUnlimited(archiveQuotaKB));
cmd.Parameters.Add("ArchiveWarningQuota", ConvertKBToUnlimited(archiveWarningQuotaKB));
ExecuteShellCommand(runSpace, cmd);
}
else
{
cmd = new Command("Disable-Mailbox");
cmd.Parameters.Add("Identity", accountName);
cmd.Parameters.Add("Archive");
ExecuteShellCommand(runSpace, cmd);
}
if (!String.IsNullOrEmpty(RetentionPolicy))
{
cmd = new Command("Set-Mailbox");
cmd.Parameters.Add("Identity", accountName);
cmd.Parameters.Add("RetentionPolicy", RetentionPolicy);
ExecuteShellCommand(runSpace, cmd);
}
}
finally
{
CloseRunspace(runSpace);
CloseRunspaceEx(runSpaceEx);
}
ExchangeLog.LogEnd("SetMailBoxArchivingInternal");
}
#endregion
#region Retention policy
public void SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention , ExchangeRetentionPolicyTagAction RetentionAction)
{
SetRetentionPolicyTagInternal(Identity, Type, AgeLimitForRetention, RetentionAction);
}
private void SetRetentionPolicyTagInternal(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
{
ExchangeLog.LogStart("SetRetentionPolicyTagInternal");
Runspace runSpace = null;
Runspace runSpaceEx = null;
try
{
runSpace = OpenRunspace();
runSpaceEx = OpenRunspaceEx();
Command cmd;
bool exists = false;
cmd = new Command("Get-RetentionPolicyTag");
cmd.Parameters.Add("Identity", Identity);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
if (result != null && result.Count > 0)
exists = true;
if (exists)
{
cmd = new Command("Set-RetentionPolicyTag");
cmd.Parameters.Add("Identity", Identity);
}
else
{
cmd = new Command("New-RetentionPolicyTag");
cmd.Parameters.Add("Name", Identity);
cmd.Parameters.Add("Type", Enum.GetName(typeof(ExchangeRetentionPolicyTagType), Type));
}
cmd.Parameters.Add("AgeLimitForRetention", AgeLimitForRetention);
cmd.Parameters.Add("RetentionAction", Enum.GetName(typeof(ExchangeRetentionPolicyTagAction), RetentionAction));
cmd.Parameters.Add("RetentionEnabled", true);
object[] errors;
result = ExecuteShellCommand(runSpace, cmd,out errors);
}
finally
{
CloseRunspace(runSpace);
CloseRunspaceEx(runSpaceEx);
}
ExchangeLog.LogEnd("SetRetentionPolicyTagInternal");
}
public void RemoveRetentionPolicyTag(string Identity)
{
RemoveRetentionPolicyTagInternal(Identity);
}
private void RemoveRetentionPolicyTagInternal(string Identity)
{
ExchangeLog.LogStart("RemoveRetentionPolicyTagInternal");
Runspace runSpace = null;
Runspace runSpaceEx = null;
try
{
runSpace = OpenRunspace();
runSpaceEx = OpenRunspaceEx();
Command cmd;
bool exists = false;
cmd = new Command("Remove-RetentionPolicyTag");
cmd.Parameters.Add("Identity", Identity);
ExecuteShellCommand(runSpace, cmd);
}
finally
{
CloseRunspace(runSpace);
CloseRunspaceEx(runSpaceEx);
}
ExchangeLog.LogEnd("RemoveRetentionPolicyTagInternal");
}
public void SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks)
{
SetRetentionPolicyInternal(Identity, RetentionPolicyTagLinks);
}
private void SetRetentionPolicyInternal(string Identity, string[] RetentionPolicyTagLinks)
{
ExchangeLog.LogStart("SetRetentionPolicyInternal");
Runspace runSpace = null;
Runspace runSpaceEx = null;
try
{
runSpace = OpenRunspace();
runSpaceEx = OpenRunspaceEx();
Command cmd;
bool exists = false;
cmd = new Command("Get-RetentionPolicy");
cmd.Parameters.Add("Identity", Identity);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
if (result != null && result.Count > 0)
exists = true;
if (exists)
{
cmd = new Command("Set-RetentionPolicy");
cmd.Parameters.Add("Identity", Identity);
}
else
{
cmd = new Command("New-RetentionPolicy");
cmd.Parameters.Add("Name", Identity);
}
cmd.Parameters.Add("RetentionPolicyTagLinks", RetentionPolicyTagLinks);
result = ExecuteShellCommand(runSpace, cmd);
}
finally
{
CloseRunspace(runSpace);
CloseRunspaceEx(runSpaceEx);
}
ExchangeLog.LogEnd("SetRetentionPolicyInternal");
}
public void RemoveRetentionPolicy(string Identity)
{
RemoveRetentionPolicyInternal(Identity);
}
private void RemoveRetentionPolicyInternal(string Identity)
{
ExchangeLog.LogStart("RemoveRetentionPolicyInternal");
Runspace runSpace = null;
Runspace runSpaceEx = null;
try
{
runSpace = OpenRunspace();
runSpaceEx = OpenRunspaceEx();
Command cmd;
cmd = new Command("Remove-RetentionPolicy");
cmd.Parameters.Add("Identity", Identity);
ExecuteShellCommand(runSpace, cmd);
}
finally
{
CloseRunspace(runSpace);
CloseRunspaceEx(runSpaceEx);
}
ExchangeLog.LogEnd("RemoveRetentionPolicyInternal");
}
#endregion
public override bool IsInstalled() public override bool IsInstalled()
{ {

View file

@ -6965,5 +6965,38 @@ namespace WebsitePanel.Providers.HostedSolution
} }
#endregion #endregion
#region Archiving
public virtual void SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
{
// not implemented
}
#endregion
#region Retention policy
public virtual void SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
{
// not implemented
}
public virtual void RemoveRetentionPolicyTag(string Identity)
{
// not implemented
}
public virtual void SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks)
{
// not implemented
}
public virtual void RemoveRetentionPolicy(string Identity)
{
// not implemented
}
#endregion
} }
} }

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012, Outercurve Foundation. // Copyright (c) 2012-2014, Outercurve Foundation.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
@ -26,6 +26,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using WebsitePanel.Providers.HostedSolution;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -48,7 +50,6 @@ namespace WebsitePanel.Providers.Exchange
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using WebsitePanel.Providers.HostedSolution;
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
@ -74,6 +75,16 @@ namespace WebsitePanel.Providers.Exchange
private System.Threading.SendOrPostCallback RemoveDeviceOperationCompleted; private System.Threading.SendOrPostCallback RemoveDeviceOperationCompleted;
private System.Threading.SendOrPostCallback SetMailBoxArchivingOperationCompleted;
private System.Threading.SendOrPostCallback SetRetentionPolicyTagOperationCompleted;
private System.Threading.SendOrPostCallback RemoveRetentionPolicyTagOperationCompleted;
private System.Threading.SendOrPostCallback SetRetentionPolicyOperationCompleted;
private System.Threading.SendOrPostCallback RemoveRetentionPolicyOperationCompleted;
private System.Threading.SendOrPostCallback CheckAccountCredentialsOperationCompleted; private System.Threading.SendOrPostCallback CheckAccountCredentialsOperationCompleted;
private System.Threading.SendOrPostCallback ExtendToExchangeOrganizationOperationCompleted; private System.Threading.SendOrPostCallback ExtendToExchangeOrganizationOperationCompleted;
@ -203,7 +214,7 @@ namespace WebsitePanel.Providers.Exchange
/// <remarks/> /// <remarks/>
public ExchangeServer() public ExchangeServer()
{ {
this.Url = "http://localhost:9003/ExchangeServer.asmx"; this.Url = "http://localhost:9004/ExchangeServer.asmx";
} }
/// <remarks/> /// <remarks/>
@ -224,6 +235,21 @@ namespace WebsitePanel.Providers.Exchange
/// <remarks/> /// <remarks/>
public event RemoveDeviceCompletedEventHandler RemoveDeviceCompleted; public event RemoveDeviceCompletedEventHandler RemoveDeviceCompleted;
/// <remarks/>
public event SetMailBoxArchivingCompletedEventHandler SetMailBoxArchivingCompleted;
/// <remarks/>
public event SetRetentionPolicyTagCompletedEventHandler SetRetentionPolicyTagCompleted;
/// <remarks/>
public event RemoveRetentionPolicyTagCompletedEventHandler RemoveRetentionPolicyTagCompleted;
/// <remarks/>
public event SetRetentionPolicyCompletedEventHandler SetRetentionPolicyCompleted;
/// <remarks/>
public event RemoveRetentionPolicyCompletedEventHandler RemoveRetentionPolicyCompleted;
/// <remarks/> /// <remarks/>
public event CheckAccountCredentialsCompletedEventHandler CheckAccountCredentialsCompleted; public event CheckAccountCredentialsCompletedEventHandler CheckAccountCredentialsCompleted;
@ -824,6 +850,273 @@ namespace WebsitePanel.Providers.Exchange
} }
} }
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/SetMailBoxArchiving", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
{
this.Invoke("SetMailBoxArchiving", new object[] {
organizationId,
accountName,
archive,
archiveQuotaKB,
archiveWarningQuotaKB,
RetentionPolicy});
}
/// <remarks/>
public System.IAsyncResult BeginSetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("SetMailBoxArchiving", new object[] {
organizationId,
accountName,
archive,
archiveQuotaKB,
archiveWarningQuotaKB,
RetentionPolicy}, callback, asyncState);
}
/// <remarks/>
public void EndSetMailBoxArchiving(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void SetMailBoxArchivingAsync(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
{
this.SetMailBoxArchivingAsync(organizationId, accountName, archive, archiveQuotaKB, archiveWarningQuotaKB, RetentionPolicy, null);
}
/// <remarks/>
public void SetMailBoxArchivingAsync(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy, object userState)
{
if ((this.SetMailBoxArchivingOperationCompleted == null))
{
this.SetMailBoxArchivingOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetMailBoxArchivingOperationCompleted);
}
this.InvokeAsync("SetMailBoxArchiving", new object[] {
organizationId,
accountName,
archive,
archiveQuotaKB,
archiveWarningQuotaKB,
RetentionPolicy}, this.SetMailBoxArchivingOperationCompleted, userState);
}
private void OnSetMailBoxArchivingOperationCompleted(object arg)
{
if ((this.SetMailBoxArchivingCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetMailBoxArchivingCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/SetRetentionPolicyTag", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
{
this.Invoke("SetRetentionPolicyTag", new object[] {
Identity,
Type,
AgeLimitForRetention,
RetentionAction});
}
/// <remarks/>
public System.IAsyncResult BeginSetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("SetRetentionPolicyTag", new object[] {
Identity,
Type,
AgeLimitForRetention,
RetentionAction}, callback, asyncState);
}
/// <remarks/>
public void EndSetRetentionPolicyTag(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void SetRetentionPolicyTagAsync(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
{
this.SetRetentionPolicyTagAsync(Identity, Type, AgeLimitForRetention, RetentionAction, null);
}
/// <remarks/>
public void SetRetentionPolicyTagAsync(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction, object userState)
{
if ((this.SetRetentionPolicyTagOperationCompleted == null))
{
this.SetRetentionPolicyTagOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetRetentionPolicyTagOperationCompleted);
}
this.InvokeAsync("SetRetentionPolicyTag", new object[] {
Identity,
Type,
AgeLimitForRetention,
RetentionAction}, this.SetRetentionPolicyTagOperationCompleted, userState);
}
private void OnSetRetentionPolicyTagOperationCompleted(object arg)
{
if ((this.SetRetentionPolicyTagCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetRetentionPolicyTagCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/RemoveRetentionPolicyTag", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void RemoveRetentionPolicyTag(string Identity)
{
this.Invoke("RemoveRetentionPolicyTag", new object[] {
Identity});
}
/// <remarks/>
public System.IAsyncResult BeginRemoveRetentionPolicyTag(string Identity, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("RemoveRetentionPolicyTag", new object[] {
Identity}, callback, asyncState);
}
/// <remarks/>
public void EndRemoveRetentionPolicyTag(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void RemoveRetentionPolicyTagAsync(string Identity)
{
this.RemoveRetentionPolicyTagAsync(Identity, null);
}
/// <remarks/>
public void RemoveRetentionPolicyTagAsync(string Identity, object userState)
{
if ((this.RemoveRetentionPolicyTagOperationCompleted == null))
{
this.RemoveRetentionPolicyTagOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveRetentionPolicyTagOperationCompleted);
}
this.InvokeAsync("RemoveRetentionPolicyTag", new object[] {
Identity}, this.RemoveRetentionPolicyTagOperationCompleted, userState);
}
private void OnRemoveRetentionPolicyTagOperationCompleted(object arg)
{
if ((this.RemoveRetentionPolicyTagCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.RemoveRetentionPolicyTagCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/SetRetentionPolicy", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks)
{
this.Invoke("SetRetentionPolicy", new object[] {
Identity,
RetentionPolicyTagLinks});
}
/// <remarks/>
public System.IAsyncResult BeginSetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("SetRetentionPolicy", new object[] {
Identity,
RetentionPolicyTagLinks}, callback, asyncState);
}
/// <remarks/>
public void EndSetRetentionPolicy(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void SetRetentionPolicyAsync(string Identity, string[] RetentionPolicyTagLinks)
{
this.SetRetentionPolicyAsync(Identity, RetentionPolicyTagLinks, null);
}
/// <remarks/>
public void SetRetentionPolicyAsync(string Identity, string[] RetentionPolicyTagLinks, object userState)
{
if ((this.SetRetentionPolicyOperationCompleted == null))
{
this.SetRetentionPolicyOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetRetentionPolicyOperationCompleted);
}
this.InvokeAsync("SetRetentionPolicy", new object[] {
Identity,
RetentionPolicyTagLinks}, this.SetRetentionPolicyOperationCompleted, userState);
}
private void OnSetRetentionPolicyOperationCompleted(object arg)
{
if ((this.SetRetentionPolicyCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetRetentionPolicyCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/RemoveRetentionPolicy", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void RemoveRetentionPolicy(string Identity)
{
this.Invoke("RemoveRetentionPolicy", new object[] {
Identity});
}
/// <remarks/>
public System.IAsyncResult BeginRemoveRetentionPolicy(string Identity, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("RemoveRetentionPolicy", new object[] {
Identity}, callback, asyncState);
}
/// <remarks/>
public void EndRemoveRetentionPolicy(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void RemoveRetentionPolicyAsync(string Identity)
{
this.RemoveRetentionPolicyAsync(Identity, null);
}
/// <remarks/>
public void RemoveRetentionPolicyAsync(string Identity, object userState)
{
if ((this.RemoveRetentionPolicyOperationCompleted == null))
{
this.RemoveRetentionPolicyOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveRetentionPolicyOperationCompleted);
}
this.InvokeAsync("RemoveRetentionPolicy", new object[] {
Identity}, this.RemoveRetentionPolicyOperationCompleted, userState);
}
private void OnRemoveRetentionPolicyOperationCompleted(object arg)
{
if ((this.RemoveRetentionPolicyCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.RemoveRetentionPolicyCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CheckAccountCredentials", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CheckAccountCredentials", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@ -4787,6 +5080,26 @@ namespace WebsitePanel.Providers.Exchange
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void RemoveDeviceCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); public delegate void RemoveDeviceCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void SetMailBoxArchivingCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void SetRetentionPolicyTagCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void RemoveRetentionPolicyTagCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void SetRetentionPolicyCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void RemoveRetentionPolicyCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void CheckAccountCredentialsCompletedEventHandler(object sender, CheckAccountCredentialsCompletedEventArgs e); public delegate void CheckAccountCredentialsCompletedEventHandler(object sender, CheckAccountCredentialsCompletedEventArgs e);

View file

@ -1216,8 +1216,98 @@ namespace WebsitePanel.Server
} }
} }
#endregion #endregion
protected void LogStart(string func) #region Archiving
[WebMethod, SoapHeader("settings")]
public void SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
{
try
{
LogStart("SetMailBoxArchiving");
ES.SetMailBoxArchiving(organizationId, accountName, archive, archiveQuotaKB, archiveWarningQuotaKB, RetentionPolicy);
LogEnd("SetMailBoxArchiving");
}
catch (Exception ex)
{
LogError("SetMailBoxArchiving", ex);
throw;
}
}
#endregion
#region Retention policy
[WebMethod, SoapHeader("settings")]
public void SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
{
try
{
LogStart("SetRetentionPolicyTag");
ES.SetRetentionPolicyTag(Identity, Type, AgeLimitForRetention, RetentionAction);
LogEnd("SetRetentionPolicyTag");
}
catch (Exception ex)
{
LogError("SetRetentionPolicyTag", ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void RemoveRetentionPolicyTag(string Identity)
{
try
{
LogStart("RemoveRetentionPolicyTag");
ES.RemoveRetentionPolicyTag(Identity);
LogEnd("RemoveRetentionPolicyTag");
}
catch (Exception ex)
{
LogError("RemoveRetentionPolicyTag", ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks)
{
try
{
LogStart("SetRetentionPolicy");
ES.SetRetentionPolicy(Identity, RetentionPolicyTagLinks);
LogEnd("SetRetentionPolicy");
}
catch (Exception ex)
{
LogError("SetRetentionPolicy", ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void RemoveRetentionPolicy(string Identity)
{
try
{
LogStart("RemoveRetentionPolicy");
ES.RemoveRetentionPolicy(Identity);
LogEnd("RemoveRetentionPolicy");
}
catch (Exception ex)
{
LogError("RemoveRetentionPolicy", ex);
throw;
}
}
#endregion
protected void LogStart(string func)
{ {
Log.WriteStart("'{0}' {1}", ProviderSettings.ProviderName, func); Log.WriteStart("'{0}' {1}", ProviderSettings.ProviderName, func);
} }

View file

@ -80,11 +80,6 @@
<asp:CheckBox ID="chkActiveSync" runat="server" meta:resourcekey="chkActiveSync" Text="ActiveSync"></asp:CheckBox> <asp:CheckBox ID="chkActiveSync" runat="server" meta:resourcekey="chkActiveSync" Text="ActiveSync"></asp:CheckBox>
</td> </td>
</tr> </tr>
<tr>
<td>
<asp:CheckBox ID="chkEnableArchiving" runat="server" meta:resourcekey="chkEnableArchiving" Text="Archiving"></asp:CheckBox>
</td>
</tr>
</table> </table>
<br /> <br />
</asp:Panel> </asp:Panel>
@ -228,6 +223,41 @@
</table> </table>
</asp:Panel> </asp:Panel>
<wsp:CollapsiblePanel id="secArchiving" runat="server"
TargetControlID="Archiving" meta:resourcekey="secArchiving" Text="Archiving">
</wsp:CollapsiblePanel>
<asp:Panel ID="Archiving" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td class="FormLabel200">
<asp:CheckBox ID="chkEnableArchiving" runat="server" meta:resourcekey="chkEnableArchiving" Text="Archiving"></asp:CheckBox>
</td>
<td></td>
</tr>
<tr>
<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>
</div>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locArchiveWarningQuota" runat="server" meta:resourcekey="locArchiveWarningQuota" Text="Archive warning quota:"></asp:Localize></td>
<td>
<wsp:SizeBox id="archiveWarningQuota" runat="server" DisplayUnitsKB="false" DisplayUnitsMB="false" DisplayUnitsPct="true" RequireValidatorEnabled="true"/>
</td>
</tr>
</table>
<br />
</asp:Panel>
<wsp:CollapsiblePanel id="secRetentionPolicyTags" runat="server" <wsp:CollapsiblePanel id="secRetentionPolicyTags" runat="server"
TargetControlID="RetentionPolicyTags" meta:resourcekey="secRetentionPolicyTags" Text="Retention policy tags"> TargetControlID="RetentionPolicyTags" meta:resourcekey="secRetentionPolicyTags" Text="Retention policy tags">
</wsp:CollapsiblePanel> </wsp:CollapsiblePanel>

View file

@ -67,38 +67,48 @@ namespace WebsitePanel.Portal.ExchangeServer
{ {
Providers.HostedSolution.ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, PanelRequest.GetInt("MailboxPlanId")); Providers.HostedSolution.ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, PanelRequest.GetInt("MailboxPlanId"));
txtMailboxPlan.Text = plan.MailboxPlan; txtMailboxPlan.Text = plan.MailboxPlan;
mailboxSize.QuotaValue = plan.MailboxSizeMB;
maxRecipients.QuotaValue = plan.MaxRecipients;
maxSendMessageSizeKB.QuotaValue = plan.MaxSendMessageSizeKB;
maxReceiveMessageSizeKB.QuotaValue = plan.MaxReceiveMessageSizeKB;
chkPOP3.Checked = plan.EnablePOP;
chkIMAP.Checked = plan.EnableIMAP;
chkOWA.Checked = plan.EnableOWA;
chkMAPI.Checked = plan.EnableMAPI;
chkActiveSync.Checked = plan.EnableActiveSync;
sizeIssueWarning.ValueKB = plan.IssueWarningPct;
sizeProhibitSend.ValueKB = plan.ProhibitSendPct;
sizeProhibitSendReceive.ValueKB = plan.ProhibitSendReceivePct;
daysKeepDeletedItems.ValueDays = plan.KeepDeletedItemsDays;
chkHideFromAddressBook.Checked = plan.HideFromAddressBook;
chkEnableLitigationHold.Checked = plan.AllowLitigationHold;
recoverableItemsSpace.QuotaValue = plan.RecoverableItemsSpace;
recoverableItemsWarning.ValueKB = plan.RecoverableItemsWarningPct;
txtLitigationHoldMsg.Text = plan.LitigationHoldMsg;
txtLitigationHoldUrl.Text = plan.LitigationHoldUrl;
RetentionPolicy = plan.Archiving; RetentionPolicy = plan.Archiving;
chkEnableArchiving.Checked = plan.EnableArchiving;
locTitle.Text = plan.MailboxPlan;
if (RetentionPolicy) if (RetentionPolicy)
{ {
ExchangeMailboxPlanRetentionPolicyTag[] tags = ES.Services.ExchangeServer.GetExchangeMailboxPlanRetentionPolicyTags(plan.MailboxPlanId); chkEnableArchiving.Checked = plan.EnableArchiving;
archiveQuota.QuotaValue = plan.MailboxSizeMB;
archiveWarningQuota.ValueKB = plan.IssueWarningPct;
List<ExchangeMailboxPlanRetentionPolicyTag> tags = new List<ExchangeMailboxPlanRetentionPolicyTag>();
tags.AddRange(ES.Services.ExchangeServer.GetExchangeMailboxPlanRetentionPolicyTags(plan.MailboxPlanId));
ViewState["Tags"] = tags;
gvPolicy.DataSource = tags; gvPolicy.DataSource = tags;
gvPolicy.DataBind(); gvPolicy.DataBind();
UpdateTags();
} }
else
{
mailboxSize.QuotaValue = plan.MailboxSizeMB;
maxRecipients.QuotaValue = plan.MaxRecipients;
maxSendMessageSizeKB.QuotaValue = plan.MaxSendMessageSizeKB;
maxReceiveMessageSizeKB.QuotaValue = plan.MaxReceiveMessageSizeKB;
chkPOP3.Checked = plan.EnablePOP;
chkIMAP.Checked = plan.EnableIMAP;
chkOWA.Checked = plan.EnableOWA;
chkMAPI.Checked = plan.EnableMAPI;
chkActiveSync.Checked = plan.EnableActiveSync;
sizeIssueWarning.ValueKB = plan.IssueWarningPct;
sizeProhibitSend.ValueKB = plan.ProhibitSendPct;
sizeProhibitSendReceive.ValueKB = plan.ProhibitSendReceivePct;
daysKeepDeletedItems.ValueDays = plan.KeepDeletedItemsDays;
chkHideFromAddressBook.Checked = plan.HideFromAddressBook;
chkEnableLitigationHold.Checked = plan.AllowLitigationHold;
recoverableItemsSpace.QuotaValue = plan.RecoverableItemsSpace;
recoverableItemsWarning.ValueKB = plan.RecoverableItemsWarningPct;
txtLitigationHoldMsg.Text = plan.LitigationHoldMsg;
txtLitigationHoldUrl.Text = plan.LitigationHoldUrl;
}
locTitle.Text = plan.MailboxPlan;
this.DisableControls = true; this.DisableControls = true;
@ -177,12 +187,16 @@ namespace WebsitePanel.Portal.ExchangeServer
locTitle.Text = RetentionPolicy ? GetLocalizedString("locTitleArchiving.Text") : GetLocalizedString("locTitle.Text"); locTitle.Text = RetentionPolicy ? GetLocalizedString("locTitleArchiving.Text") : GetLocalizedString("locTitle.Text");
UpdateTags();
secMailboxFeatures.Visible = !RetentionPolicy; secMailboxFeatures.Visible = !RetentionPolicy;
secMailboxGeneral.Visible = !RetentionPolicy; secMailboxGeneral.Visible = !RetentionPolicy;
secStorageQuotas.Visible = !RetentionPolicy;
secDeleteRetention.Visible = !RetentionPolicy;
secLitigationHold.Visible = !RetentionPolicy;
secArchiving.Visible = RetentionPolicy;
secRetentionPolicyTags.Visible = RetentionPolicy; secRetentionPolicyTags.Visible = RetentionPolicy;
btnAdd.CausesValidation = RetentionPolicy;
} }
@ -222,36 +236,45 @@ namespace WebsitePanel.Portal.ExchangeServer
{ {
Providers.HostedSolution.ExchangeMailboxPlan plan = new Providers.HostedSolution.ExchangeMailboxPlan(); Providers.HostedSolution.ExchangeMailboxPlan plan = new Providers.HostedSolution.ExchangeMailboxPlan();
plan.MailboxPlan = txtMailboxPlan.Text; plan.MailboxPlan = txtMailboxPlan.Text;
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.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.Archiving = RetentionPolicy; plan.Archiving = RetentionPolicy;
plan.EnableArchiving = chkEnableArchiving.Checked; if (RetentionPolicy)
{
plan.EnableArchiving = chkEnableArchiving.Checked;
plan.MailboxSizeMB = archiveQuota.QuotaValue;
plan.IssueWarningPct = archiveWarningQuota.ValueKB;
if ((plan.IssueWarningPct == 0)) plan.IssueWarningPct = 100;
}
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.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();
}
int planId = ES.Services.ExchangeServer.AddExchangeMailboxPlan(PanelRequest.ItemID, int planId = ES.Services.ExchangeServer.AddExchangeMailboxPlan(PanelRequest.ItemID,
plan); plan);

View file

@ -174,15 +174,6 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkActiveSync; protected global::System.Web.UI.WebControls.CheckBox chkActiveSync;
/// <summary>
/// chkEnableArchiving 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.CheckBox chkEnableArchiving;
/// <summary> /// <summary>
/// secMailboxGeneral control. /// secMailboxGeneral control.
/// </summary> /// </summary>
@ -498,6 +489,69 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtLitigationHoldMsg; protected global::System.Web.UI.WebControls.TextBox txtLitigationHoldMsg;
/// <summary>
/// secArchiving control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secArchiving;
/// <summary>
/// Archiving 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.Panel Archiving;
/// <summary>
/// chkEnableArchiving 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.CheckBox chkEnableArchiving;
/// <summary>
/// locArchiveQuota 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.Localize locArchiveQuota;
/// <summary>
/// archiveQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaEditor archiveQuota;
/// <summary>
/// locArchiveWarningQuota 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.Localize locArchiveWarningQuota;
/// <summary>
/// archiveWarningQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.SizeBox archiveWarningQuota;
/// <summary> /// <summary>
/// secRetentionPolicyTags control. /// secRetentionPolicyTags control.
/// </summary> /// </summary>

View file

@ -147,7 +147,7 @@
</tr> </tr>
<tr> <tr>
<td class="FormLabel150"> <td class="FormLabel150">
<asp:Localize ID="locArchivingMailboxplanName" runat="server" meta:resourcekey="locArchivingMailboxplanName" Text="Archiving Mailboxplan Name: "></asp:Localize> <asp:Localize ID="locRetentionPolicyName" runat="server" meta:resourcekey="locRetentionPolicyName" Text="Retention policy Name: "></asp:Localize>
</td> </td>
<td> <td>
<wsp:MailboxPlanSelector ID="archivingMailboxPlanSelector" runat="server" Archiving="true" AddNone="true" /> <wsp:MailboxPlanSelector ID="archivingMailboxPlanSelector" runat="server" Archiving="true" AddNone="true" />

View file

@ -328,13 +328,13 @@ namespace WebsitePanel.Portal.ExchangeServer {
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelector; protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelector;
/// <summary> /// <summary>
/// locArchivingMailboxplanName control. /// locRetentionPolicyName control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Localize locArchivingMailboxplanName; protected global::System.Web.UI.WebControls.Localize locRetentionPolicyName;
/// <summary> /// <summary>
/// archivingMailboxPlanSelector control. /// archivingMailboxPlanSelector control.

View file

@ -55,7 +55,7 @@
<tr> <tr>
<td class="FormLabel150"><asp:Localize ID="Localize2" runat="server" meta:resourcekey="locMailboxplanName" Text="Mailbox plan: *"></asp:Localize></td> <td class="FormLabel150"><asp:Localize ID="Localize2" runat="server" meta:resourcekey="locMailboxplanName" Text="Mailbox plan: *"></asp:Localize></td>
<td> <td>
<wsp:MailboxPlanSelector ID="mailboxPlanSelector" runat="server" OnChanged="mailboxPlanSelector_Changed" /> <wsp:MailboxPlanSelector ID="mailboxPlanSelector" runat="server" />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -74,16 +74,10 @@
</table> </table>
</asp:Panel> </asp:Panel>
<wsp:CollapsiblePanel id="secArchiving" runat="server" TargetControlID="Archiving" meta:resourcekey="secArchiving" Text="Archiving"></wsp:CollapsiblePanel> <wsp:CollapsiblePanel id="secRetentionPolicy" runat="server" TargetControlID="RetentionPolicy" meta:resourcekey="secRetentionPolicy" Text="Retention policy"></wsp:CollapsiblePanel>
<asp:Panel ID="Archiving" runat="server" Height="0" style="overflow:hidden;"> <asp:Panel ID="RetentionPolicy" runat="server" Height="0" style="overflow:hidden;">
<table> <table>
<tr> <tr runat="server">
<td class="FormLabel150"></td>
<td>
<asp:CheckBox ID="chkArchiving" runat="server" meta:resourcekey ="chkArchiving" Text ="Enable Archiving" AutoPostBack="true" OnCheckedChanged="chkArchiving_CheckedChanged"></asp:CheckBox>
</td>
</tr>
<tr runat="server" id="mailboxArchivePlan">
<td class="FormLabel150"><asp:Localize ID="locRetentionPolicyName" runat="server" meta:resourcekey="locRetentionPolicyName" Text="Retention policy: "></asp:Localize></td> <td class="FormLabel150"><asp:Localize ID="locRetentionPolicyName" runat="server" meta:resourcekey="locRetentionPolicyName" Text="Retention policy: "></asp:Localize></td>
<td> <td>
<wsp:MailboxPlanSelector ID="mailboxRetentionPolicySelector" runat="server" Archiving="true" AddNone="true"/> <wsp:MailboxPlanSelector ID="mailboxRetentionPolicySelector" runat="server" Archiving="true" AddNone="true"/>

View file

@ -67,8 +67,6 @@ namespace WebsitePanel.Portal.ExchangeServer
BindSettings(); BindSettings();
SetArchivingVisible();
UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId); UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId);
if (user != null) if (user != null)
@ -124,12 +122,10 @@ namespace WebsitePanel.Portal.ExchangeServer
if (account.ArchivingMailboxPlanId<1) if (account.ArchivingMailboxPlanId<1)
{ {
mailboxRetentionPolicySelector.MailboxPlanId = "-1"; mailboxRetentionPolicySelector.MailboxPlanId = "-1";
chkArchiving.Checked = false;
} }
else else
{ {
mailboxRetentionPolicySelector.MailboxPlanId = account.ArchivingMailboxPlanId.ToString(); mailboxRetentionPolicySelector.MailboxPlanId = account.ArchivingMailboxPlanId.ToString();
chkArchiving.Checked = true;
} }
mailboxSize.QuotaUsedValue = Convert.ToInt32(stats.TotalSize / 1024 / 1024); mailboxSize.QuotaUsedValue = Convert.ToInt32(stats.TotalSize / 1024 / 1024);
@ -182,8 +178,7 @@ namespace WebsitePanel.Portal.ExchangeServer
{ {
int planId = Convert.ToInt32(mailboxPlanSelector.MailboxPlanId); int planId = Convert.ToInt32(mailboxPlanSelector.MailboxPlanId);
int policyId = -1; int policyId = -1;
if (chkArchiving.Checked) int.TryParse(mailboxRetentionPolicySelector.MailboxPlanId, out policyId);
policyId = Convert.ToInt32(mailboxRetentionPolicySelector.MailboxPlanId);
result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(PanelRequest.ItemID, PanelRequest.AccountID, planId, result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(PanelRequest.ItemID, PanelRequest.AccountID, planId,
policyId); policyId);
@ -264,35 +259,5 @@ namespace WebsitePanel.Portal.ExchangeServer
return result; return result;
} }
protected void chkArchiving_CheckedChanged(object sender, EventArgs e)
{
SetArchivingVisible();
}
private void SetArchivingVisible()
{
int id;
if (!int.TryParse(mailboxPlanSelector.MailboxPlanId, out id))
return;
bool archiving = false;
ExchangeMailboxPlan policy = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, id);
if (policy != null)
archiving = policy.EnableArchiving & Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, Cntx);
if (!archiving)
chkArchiving.Checked = false;
secArchiving.Visible = archiving;
mailboxArchivePlan.Visible = chkArchiving.Checked;
}
protected void mailboxPlanSelector_Changed(object sender, EventArgs e)
{
SetArchivingVisible();
}
} }
} }

View file

@ -175,40 +175,22 @@ namespace WebsitePanel.Portal.ExchangeServer {
protected global::WebsitePanel.Portal.QuotaViewer mailboxSize; protected global::WebsitePanel.Portal.QuotaViewer mailboxSize;
/// <summary> /// <summary>
/// secArchiving control. /// secRetentionPolicy control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secArchiving; protected global::WebsitePanel.Portal.CollapsiblePanel secRetentionPolicy;
/// <summary> /// <summary>
/// Archiving control. /// RetentionPolicy control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Panel Archiving; protected global::System.Web.UI.WebControls.Panel RetentionPolicy;
/// <summary>
/// chkArchiving 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.CheckBox chkArchiving;
/// <summary>
/// mailboxArchivePlan 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 mailboxArchivePlan;
/// <summary> /// <summary>
/// locRetentionPolicyName control. /// locRetentionPolicyName control.

View file

@ -103,11 +103,6 @@
<asp:CheckBox ID="chkActiveSync" runat="server" meta:resourcekey="chkActiveSync" Text="ActiveSync"></asp:CheckBox> <asp:CheckBox ID="chkActiveSync" runat="server" meta:resourcekey="chkActiveSync" Text="ActiveSync"></asp:CheckBox>
</td> </td>
</tr> </tr>
<tr>
<td>
<asp:CheckBox ID="chkEnableArchiving" runat="server" meta:resourcekey="chkEnableArchiving" Text="Archiving"></asp:CheckBox>
</td>
</tr>
</table> </table>
<br /> <br />
</asp:Panel> </asp:Panel>
@ -260,6 +255,74 @@
</table> </table>
</asp:Panel> </asp:Panel>
<wsp:CollapsiblePanel id="secArchiving" runat="server"
TargetControlID="Archiving" meta:resourcekey="secArchiving" Text="Archiving">
</wsp:CollapsiblePanel>
<asp:Panel ID="Archiving" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td class="FormLabel200">
<asp:CheckBox ID="chkEnableArchiving" runat="server" meta:resourcekey="chkEnableArchiving" Text="Archiving"></asp:CheckBox>
</td>
<td></td>
</tr>
<tr>
<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>
</div>
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locArchiveWarningQuota" runat="server" meta:resourcekey="locArchiveWarningQuota" Text="Archive warning quota:"></asp:Localize></td>
<td>
<wsp:SizeBox id="archiveWarningQuota" runat="server" DisplayUnitsKB="false" DisplayUnitsMB="false" DisplayUnitsPct="true" />
</td>
</tr>
</table>
<br />
</asp:Panel>
<wsp:CollapsiblePanel id="secRetentionPolicyTags" runat="server"
TargetControlID="RetentionPolicyTags" meta:resourcekey="secRetentionPolicyTags" Text="Retention policy tags">
</wsp:CollapsiblePanel>
<asp:Panel ID="RetentionPolicyTags" runat="server" Height="0" style="overflow:hidden;">
<asp:UpdatePanel ID="GeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:GridView id="gvPolicy" runat="server" EnableViewState="true" AutoGenerateColumns="false"
Width="100%" EmptyDataText="" CssSelectorClass="NormalGridView" OnRowCommand="gvPolicy_RowCommand" >
<Columns>
<asp:TemplateField HeaderText="Tag">
<ItemStyle Width="70%"></ItemStyle>
<ItemTemplate>
<asp:Label id="displayPolicy" runat="server" EnableViewState="true" ><%# PortalAntiXSS.Encode((string)Eval("TagName"))%></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
&nbsp;<asp:ImageButton id="imgDelPolicy" runat="server" Text="Delete" SkinID="ExchangeDelete"
CommandName="DeleteItem" CommandArgument='<%# Eval("TagId") %>'
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected policy tag?')" >
</asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<asp:DropDownList ID="ddTags" runat ="server"></asp:DropDownList>
<asp:Button ID="bntAddTag" runat="server" Text="Add tag" meta:resourcekey="bntAddTag" OnClick="bntAddTag_Click"/>
<br />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<table> <table>
<tr> <tr>

View file

@ -70,10 +70,21 @@ namespace WebsitePanel.Portal
secMailboxFeatures.Visible = !RetentionPolicy; secMailboxFeatures.Visible = !RetentionPolicy;
secMailboxGeneral.Visible = !RetentionPolicy; secMailboxGeneral.Visible = !RetentionPolicy;
secStorageQuotas.Visible = !RetentionPolicy;
secDeleteRetention.Visible = !RetentionPolicy;
secLitigationHold.Visible = !RetentionPolicy;
secArchiving.Visible = RetentionPolicy;
secRetentionPolicyTags.Visible = RetentionPolicy;
gvMailboxPlans.Columns[4].Visible = !RetentionPolicy; gvMailboxPlans.Columns[4].Visible = !RetentionPolicy;
gvMailboxPlans.Columns[5].Visible = !RetentionPolicy; gvMailboxPlans.Columns[5].Visible = !RetentionPolicy;
btnAddMailboxPlan.CausesValidation = RetentionPolicy;
btnUpdateMailboxPlan.CausesValidation = RetentionPolicy;
UpdateTags();
} }
@ -109,44 +120,54 @@ namespace WebsitePanel.Portal
public void btnAddMailboxPlan_Click(object sender, EventArgs e) public void btnAddMailboxPlan_Click(object sender, EventArgs e)
{ {
Page.Validate("CreateMailboxPlan"); if (!RetentionPolicy)
Page.Validate("CreateMailboxPlan");
if (!Page.IsValid) if (!Page.IsValid)
return; return;
Providers.HostedSolution.ExchangeMailboxPlan plan = new Providers.HostedSolution.ExchangeMailboxPlan(); Providers.HostedSolution.ExchangeMailboxPlan plan = new Providers.HostedSolution.ExchangeMailboxPlan();
plan.MailboxPlan = txtMailboxPlan.Text; plan.MailboxPlan = txtMailboxPlan.Text;
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.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.Archiving = RetentionPolicy; plan.Archiving = RetentionPolicy;
if (RetentionPolicy)
{
plan.EnableArchiving = chkEnableArchiving.Checked;
plan.MailboxSizeMB = archiveQuota.QuotaValue;
plan.IssueWarningPct = archiveWarningQuota.ValueKB;
if ((plan.IssueWarningPct == 0)) plan.IssueWarningPct = 100;
}
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.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();
}
if (PanelSecurity.SelectedUser.Role == UserRole.Administrator) if (PanelSecurity.SelectedUser.Role == UserRole.Administrator)
plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Administrator; plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Administrator;
else else
@ -172,13 +193,16 @@ namespace WebsitePanel.Portal
if ((orgs != null) & (orgs.GetLength(0) > 0)) if ((orgs != null) & (orgs.GetLength(0) > 0))
{ {
int result = ES.Services.ExchangeServer.AddExchangeMailboxPlan(orgs[0].Id, plan); int planId = ES.Services.ExchangeServer.AddExchangeMailboxPlan(orgs[0].Id, plan);
if (result < 0) if (planId < 0)
{ {
messageBox.ShowResultMessage(result); messageBox.ShowResultMessage(planId);
return; return;
} }
if (RetentionPolicy)
SaveTags(orgs[0].Id, planId);
} }
BindMailboxPlans(); BindMailboxPlans();
@ -251,6 +275,13 @@ namespace WebsitePanel.Portal
txtLitigationHoldUrl.Text = string.Empty; txtLitigationHoldUrl.Text = string.Empty;
chkEnableArchiving.Checked = false; chkEnableArchiving.Checked = false;
archiveQuota.QuotaValue = 0;
archiveWarningQuota.ValueKB = 0;
ViewState["Tags"] = null;
gvPolicy.DataSource = null;
gvPolicy.DataBind();
UpdateTags();
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true; btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
@ -282,30 +313,48 @@ namespace WebsitePanel.Portal
plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(orgs[0].Id, mailboxPlanId); plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(orgs[0].Id, mailboxPlanId);
txtMailboxPlan.Text = plan.MailboxPlan; txtMailboxPlan.Text = plan.MailboxPlan;
mailboxSize.QuotaValue = plan.MailboxSizeMB;
maxRecipients.QuotaValue = plan.MaxRecipients;
maxSendMessageSizeKB.QuotaValue = plan.MaxSendMessageSizeKB;
maxReceiveMessageSizeKB.QuotaValue = plan.MaxReceiveMessageSizeKB;
chkPOP3.Checked = plan.EnablePOP;
chkIMAP.Checked = plan.EnableIMAP;
chkOWA.Checked = plan.EnableOWA;
chkMAPI.Checked = plan.EnableMAPI;
chkActiveSync.Checked = plan.EnableActiveSync;
sizeIssueWarning.ValueKB = plan.IssueWarningPct;
sizeProhibitSend.ValueKB = plan.ProhibitSendPct;
sizeProhibitSendReceive.ValueKB = plan.ProhibitSendReceivePct;
if (plan.KeepDeletedItemsDays != -1)
daysKeepDeletedItems.ValueDays = plan.KeepDeletedItemsDays;
chkHideFromAddressBook.Checked = plan.HideFromAddressBook;
chkEnableLitigationHold.Checked = plan.AllowLitigationHold;
recoverableItemsSpace.QuotaValue = plan.RecoverableItemsSpace;
recoverableItemsWarning.ValueKB = plan.RecoverableItemsWarningPct;
txtLitigationHoldMsg.Text = plan.LitigationHoldMsg;
txtLitigationHoldUrl.Text = plan.LitigationHoldUrl;
chkEnableArchiving.Checked = plan.EnableArchiving; if (RetentionPolicy)
{
chkEnableArchiving.Checked = plan.EnableArchiving;
archiveQuota.QuotaValue = plan.MailboxSizeMB;
archiveWarningQuota.ValueKB = plan.IssueWarningPct;
List<ExchangeMailboxPlanRetentionPolicyTag> tags = new List<ExchangeMailboxPlanRetentionPolicyTag>();
tags.AddRange(ES.Services.ExchangeServer.GetExchangeMailboxPlanRetentionPolicyTags(plan.MailboxPlanId));
ViewState["Tags"] = tags;
gvPolicy.DataSource = tags;
gvPolicy.DataBind();
UpdateTags();
}
else
{
mailboxSize.QuotaValue = plan.MailboxSizeMB;
maxRecipients.QuotaValue = plan.MaxRecipients;
maxSendMessageSizeKB.QuotaValue = plan.MaxSendMessageSizeKB;
maxReceiveMessageSizeKB.QuotaValue = plan.MaxReceiveMessageSizeKB;
chkPOP3.Checked = plan.EnablePOP;
chkIMAP.Checked = plan.EnableIMAP;
chkOWA.Checked = plan.EnableOWA;
chkMAPI.Checked = plan.EnableMAPI;
chkActiveSync.Checked = plan.EnableActiveSync;
sizeIssueWarning.ValueKB = plan.IssueWarningPct;
sizeProhibitSend.ValueKB = plan.ProhibitSendPct;
sizeProhibitSendReceive.ValueKB = plan.ProhibitSendReceivePct;
if (plan.KeepDeletedItemsDays != -1)
daysKeepDeletedItems.ValueDays = plan.KeepDeletedItemsDays;
chkHideFromAddressBook.Checked = plan.HideFromAddressBook;
chkEnableLitigationHold.Checked = plan.AllowLitigationHold;
recoverableItemsSpace.QuotaValue = plan.RecoverableItemsSpace;
recoverableItemsWarning.ValueKB = plan.RecoverableItemsWarningPct;
txtLitigationHoldMsg.Text = plan.LitigationHoldMsg;
txtLitigationHoldUrl.Text = plan.LitigationHoldUrl;
}
btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true; btnUpdateMailboxPlan.Enabled = (string.IsNullOrEmpty(txtMailboxPlan.Text)) ? false : true;
@ -388,37 +437,48 @@ namespace WebsitePanel.Portal
plan = new Providers.HostedSolution.ExchangeMailboxPlan(); plan = new Providers.HostedSolution.ExchangeMailboxPlan();
plan.MailboxPlanId = (int)ViewState["MailboxPlanID"]; plan.MailboxPlanId = (int)ViewState["MailboxPlanID"];
plan.MailboxPlan = txtMailboxPlan.Text; plan.MailboxPlan = txtMailboxPlan.Text;
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.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.Archiving = RetentionPolicy; plan.Archiving = RetentionPolicy;
if (RetentionPolicy)
{
plan.EnableArchiving = chkEnableArchiving.Checked;
plan.MailboxSizeMB = archiveQuota.QuotaValue;
plan.IssueWarningPct = archiveWarningQuota.ValueKB;
if ((plan.IssueWarningPct == 0)) plan.IssueWarningPct = 100;
}
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.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();
}
if (PanelSecurity.SelectedUser.Role == UserRole.Administrator) if (PanelSecurity.SelectedUser.Role == UserRole.Administrator)
plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Administrator; plan.MailboxPlanType = (int)ExchangeMailboxPlanType.Administrator;
else else
@ -436,8 +496,12 @@ namespace WebsitePanel.Portal
} }
else else
{ {
if (RetentionPolicy)
SaveTags(orgs[0].Id, mailboxPlanId);
messageBox.ShowSuccessMessage("EXCHANGE_UPDATEPLANS"); messageBox.ShowSuccessMessage("EXCHANGE_UPDATEPLANS");
} }
} }
BindMailboxPlans(); BindMailboxPlans();
@ -518,5 +582,130 @@ namespace WebsitePanel.Portal
BindMailboxPlans(); BindMailboxPlans();
} }
protected void gvPolicy_RowCommand(object sender, GridViewCommandEventArgs e)
{
switch (e.CommandName)
{
case "DeleteItem":
try
{
int tagId;
if (!int.TryParse(e.CommandArgument.ToString(), out tagId))
return;
List<ExchangeMailboxPlanRetentionPolicyTag> tags = ViewState["Tags"] as List<ExchangeMailboxPlanRetentionPolicyTag>;
if (tags == null) return;
int i = tags.FindIndex(x => x.TagID == tagId);
if (i >= 0) tags.RemoveAt(i);
ViewState["Tags"] = tags;
gvPolicy.DataSource = tags;
gvPolicy.DataBind();
UpdateTags();
}
catch (Exception)
{
}
break;
}
}
protected void bntAddTag_Click(object sender, EventArgs e)
{
int addTagId;
if (!int.TryParse(ddTags.SelectedValue, out addTagId))
return;
Providers.HostedSolution.ExchangeRetentionPolicyTag tag = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTag(PanelRequest.ItemID, addTagId);
if (tag == null) return;
List<ExchangeMailboxPlanRetentionPolicyTag> res = ViewState["Tags"] as List<ExchangeMailboxPlanRetentionPolicyTag>;
if (res == null) res = new List<ExchangeMailboxPlanRetentionPolicyTag>();
ExchangeMailboxPlanRetentionPolicyTag add = new ExchangeMailboxPlanRetentionPolicyTag();
add.MailboxPlanId = PanelRequest.GetInt("MailboxPlanId");
add.TagID = tag.TagID;
add.TagName = tag.TagName;
res.Add(add);
ViewState["Tags"] = res;
gvPolicy.DataSource = res;
gvPolicy.DataBind();
UpdateTags();
}
protected void UpdateTags()
{
if (RetentionPolicy)
{
ddTags.Items.Clear();
Providers.HostedSolution.Organization[] orgs = null;
if (PanelSecurity.SelectedUserId != 1)
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
Providers.HostedSolution.ExchangeRetentionPolicyTag[] allTags = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTags(orgs[0].Id);
List<ExchangeMailboxPlanRetentionPolicyTag> selectedTags = ViewState["Tags"] as List<ExchangeMailboxPlanRetentionPolicyTag>;
foreach (Providers.HostedSolution.ExchangeRetentionPolicyTag tag in allTags)
{
if (selectedTags != null)
{
if (selectedTags.Find(x => x.TagID == tag.TagID) != null)
continue;
}
ddTags.Items.Add(new System.Web.UI.WebControls.ListItem(tag.TagName, tag.TagID.ToString()));
}
}
}
}
protected void SaveTags(int ItemId, int planId)
{
ExchangeMailboxPlanRetentionPolicyTag[] currenttags = ES.Services.ExchangeServer.GetExchangeMailboxPlanRetentionPolicyTags(planId);
foreach (ExchangeMailboxPlanRetentionPolicyTag tag in currenttags)
ES.Services.ExchangeServer.DeleteExchangeMailboxPlanRetentionPolicyTag(ItemId, planId, tag.PlanTagID);
List<ExchangeMailboxPlanRetentionPolicyTag> tags = ViewState["Tags"] as List<ExchangeMailboxPlanRetentionPolicyTag>;
if (tags != null)
{
foreach (ExchangeMailboxPlanRetentionPolicyTag tag in tags)
{
tag.MailboxPlanId = planId;
int result = ES.Services.ExchangeServer.AddExchangeMailboxPlanRetentionPolicyTag(ItemId, tag);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
}
}
}
} }
} }

View file

@ -138,15 +138,6 @@ namespace WebsitePanel.Portal {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkActiveSync; protected global::System.Web.UI.WebControls.CheckBox chkActiveSync;
/// <summary>
/// chkEnableArchiving 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.CheckBox chkEnableArchiving;
/// <summary> /// <summary>
/// secMailboxGeneral control. /// secMailboxGeneral control.
/// </summary> /// </summary>
@ -462,6 +453,123 @@ namespace WebsitePanel.Portal {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtLitigationHoldMsg; protected global::System.Web.UI.WebControls.TextBox txtLitigationHoldMsg;
/// <summary>
/// secArchiving control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secArchiving;
/// <summary>
/// Archiving 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.Panel Archiving;
/// <summary>
/// chkEnableArchiving 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.CheckBox chkEnableArchiving;
/// <summary>
/// locArchiveQuota 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.Localize locArchiveQuota;
/// <summary>
/// archiveQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaEditor archiveQuota;
/// <summary>
/// locArchiveWarningQuota 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.Localize locArchiveWarningQuota;
/// <summary>
/// archiveWarningQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.SizeBox archiveWarningQuota;
/// <summary>
/// secRetentionPolicyTags control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secRetentionPolicyTags;
/// <summary>
/// RetentionPolicyTags 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.Panel RetentionPolicyTags;
/// <summary>
/// GeneralUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel GeneralUpdatePanel;
/// <summary>
/// gvPolicy 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.GridView gvPolicy;
/// <summary>
/// ddTags 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.DropDownList ddTags;
/// <summary>
/// bntAddTag 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.Button bntAddTag;
/// <summary> /// <summary>
/// btnAddMailboxPlan control. /// btnAddMailboxPlan control.
/// </summary> /// </summary>