Fix archiving

This commit is contained in:
dev_amdtel 2014-04-22 18:39:33 +04:00
parent 10f216b713
commit ae91a18405
25 changed files with 702 additions and 304 deletions

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -118,7 +118,7 @@ order by rg.groupOrder
public const string EXCHANGE2007_ALLOWLITIGATIONHOLD = "Exchange2007.AllowLitigationHold";
public const string EXCHANGE2007_RECOVERABLEITEMSSPACE = "Exchange2007.RecoverableItemsSpace";
public const string EXCHANGE2007_DISCLAIMERSALLOWED = "Exchange2007.DisclaimersAllowed";
public const string EXCHANGE2013_ALLOWARCHIVING = "Exchange2013.AllowArchiving"; // Archiving
public const string EXCHANGE2013_ALLOWRETENTIONPOLICY = "Exchange2013.AllowRetentionPolicy"; // Archiving
public const string EXCHANGE2013_ARCHIVINGSTORAGE = "Exchange2013.ArchivingStorage";
public const string EXCHANGE2013_ARCHIVINGMAILBOXES = "Exchange2013.ArchivingMailboxes";
public const string MSSQL2000_DATABASES = "MsSQL2000.Databases"; // Databases

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -26,10 +26,14 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.OS;
using WebsitePanel.Providers.ResultObjects;
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -1048,11 +1052,11 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddExchangeRetentionPolicyTag", 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 AddExchangeRetentionPolicyTag(int itemId, ExchangeRetentionPolicyTag tag) {
public IntResult AddExchangeRetentionPolicyTag(int itemId, ExchangeRetentionPolicyTag tag) {
object[] results = this.Invoke("AddExchangeRetentionPolicyTag", new object[] {
itemId,
tag});
return ((int)(results[0]));
return ((IntResult)(results[0]));
}
/// <remarks/>
@ -1063,9 +1067,9 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
public int EndAddExchangeRetentionPolicyTag(System.IAsyncResult asyncResult) {
public IntResult EndAddExchangeRetentionPolicyTag(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
return ((IntResult)(results[0]));
}
/// <remarks/>
@ -1092,11 +1096,11 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/UpdateExchangeRetentionPolicyTag", 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 UpdateExchangeRetentionPolicyTag(int itemId, ExchangeRetentionPolicyTag tag) {
public ResultObject UpdateExchangeRetentionPolicyTag(int itemId, ExchangeRetentionPolicyTag tag) {
object[] results = this.Invoke("UpdateExchangeRetentionPolicyTag", new object[] {
itemId,
tag});
return ((int)(results[0]));
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -1107,9 +1111,9 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
public int EndUpdateExchangeRetentionPolicyTag(System.IAsyncResult asyncResult) {
public ResultObject EndUpdateExchangeRetentionPolicyTag(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -1136,11 +1140,11 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteExchangeRetentionPolicyTag", 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 DeleteExchangeRetentionPolicyTag(int itemId, int tagId) {
public ResultObject DeleteExchangeRetentionPolicyTag(int itemId, int tagId) {
object[] results = this.Invoke("DeleteExchangeRetentionPolicyTag", new object[] {
itemId,
tagId});
return ((int)(results[0]));
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -1151,9 +1155,9 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
public int EndDeleteExchangeRetentionPolicyTag(System.IAsyncResult asyncResult) {
public ResultObject EndDeleteExchangeRetentionPolicyTag(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -1223,11 +1227,11 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddExchangeMailboxPlanRetentionPolic" +
"yTag", 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 AddExchangeMailboxPlanRetentionPolicyTag(int itemId, ExchangeMailboxPlanRetentionPolicyTag planTag) {
public IntResult AddExchangeMailboxPlanRetentionPolicyTag(int itemId, ExchangeMailboxPlanRetentionPolicyTag planTag) {
object[] results = this.Invoke("AddExchangeMailboxPlanRetentionPolicyTag", new object[] {
itemId,
planTag});
return ((int)(results[0]));
return ((IntResult)(results[0]));
}
/// <remarks/>
@ -1238,9 +1242,9 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
public int EndAddExchangeMailboxPlanRetentionPolicyTag(System.IAsyncResult asyncResult) {
public IntResult EndAddExchangeMailboxPlanRetentionPolicyTag(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
return ((IntResult)(results[0]));
}
/// <remarks/>
@ -1268,12 +1272,12 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
[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)]
public int DeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int policyId, int planTagId) {
public ResultObject DeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int policyId, int planTagId) {
object[] results = this.Invoke("DeleteExchangeMailboxPlanRetentionPolicyTag", new object[] {
itemID,
policyId,
planTagId});
return ((int)(results[0]));
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -1285,9 +1289,9 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
public int EndDeleteExchangeMailboxPlanRetentionPolicyTag(System.IAsyncResult asyncResult) {
public ResultObject EndDeleteExchangeMailboxPlanRetentionPolicyTag(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -5808,10 +5812,10 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
public int Result {
public IntResult Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
return ((IntResult)(this.results[0]));
}
}
}
@ -5834,10 +5838,10 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
public int Result {
public ResultObject Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
return ((ResultObject)(this.results[0]));
}
}
}
@ -5860,10 +5864,10 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
public int Result {
public ResultObject Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
return ((ResultObject)(this.results[0]));
}
}
}
@ -5912,10 +5916,10 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
public int Result {
public IntResult Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
return ((IntResult)(this.results[0]));
}
}
}
@ -5938,10 +5942,10 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
public int Result {
public ResultObject Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
return ((ResultObject)(this.results[0]));
}
}
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -1758,7 +1758,13 @@ namespace WebsitePanel.EnterpriseServer
UpdateExchangeAccount(accountId, accountName, accountType, displayName, email, false, pmmActions.ToString(), samAccount, password, mailboxPlanId, archivedPlanId, subscriberNumber);
SetMailBoxRetentionPolicy(itemId, archivedPlanId, accountName, exchange, org.OrganizationId);
ResultObject resPolicy = new ResultObject() { IsSuccess = true };
SetMailBoxRetentionPolicy(itemId, archivedPlanId, accountName, exchange, org.OrganizationId, resPolicy);
if (!resPolicy.IsSuccess)
{
TaskManager.WriteError("Error SetMailBoxRetentionPolicy", resPolicy.ErrorCodes.ToArray());
}
// send setup instructions
if (sendSetupInstructions)
@ -2700,7 +2706,12 @@ namespace WebsitePanel.EnterpriseServer
plan.LitigationHoldUrl,
plan.LitigationHoldMsg);
SetMailBoxRetentionPolicy(itemId, archivePlanId, account.UserPrincipalName, exchange, org.OrganizationId);
ResultObject resPolicy = new ResultObject() { IsSuccess = true };
SetMailBoxRetentionPolicy(itemId, archivePlanId, account.UserPrincipalName, exchange, org.OrganizationId, resPolicy);
if (!resPolicy.IsSuccess)
{
TaskManager.WriteError("Error SetMailBoxRetentionPolicy", resPolicy.ErrorCodes.ToArray());
}
DataProvider.SetExchangeAccountMailboxPlan(accountId, mailboxPlanId, archivePlanId);
@ -3016,8 +3027,9 @@ namespace WebsitePanel.EnterpriseServer
#region Exchange Retention Policy Tags
private static void SetMailBoxRetentionPolicy(int itemId, int retentionPolicyId, string accountName, ExchangeServer exchange, string orgId)
private static void SetMailBoxRetentionPolicy(int itemId, int retentionPolicyId, string accountName, ExchangeServer exchange, string orgId, ResultObject result)
{
bool archive = false;
long archiveQuotaKB = 0;
long archiveWarningQuotaKB = 0;
@ -3031,19 +3043,22 @@ namespace WebsitePanel.EnterpriseServer
archiveQuotaKB = retentionPolicy.MailboxSizeMB != -1 ? ((long)retentionPolicy.MailboxSizeMB * 1024) : -1;
archiveWarningQuotaKB = retentionPolicy.MailboxSizeMB != -1 ? (((long)retentionPolicy.IssueWarningPct * (long)retentionPolicy.MailboxSizeMB * 1024) / 100) : -1;
// update
// update PlanRetentionPolicy and Tags
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);
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;
}
UpdateExchangeMailboxPlanRetentionPolicyTags(itemId, retentionPolicyId);
UpdateExchangeRetentionPolicy(itemId, retentionPolicyId, result);
}
}
exchange.SetMailBoxArchiving(orgId, accountName, archive, archiveQuotaKB, archiveWarningQuotaKB, RetentionPolicy);
ResultObject res = exchange.SetMailBoxArchiving(orgId, accountName, archive, archiveQuotaKB, archiveWarningQuotaKB, RetentionPolicy);
result.ErrorCodes.AddRange(res.ErrorCodes);
result.IsSuccess = result.IsSuccess && res.IsSuccess;
}
public static List<ExchangeRetentionPolicyTag> GetExchangeRetentionPolicyTags(int itemId)
@ -3136,17 +3151,84 @@ namespace WebsitePanel.EnterpriseServer
}
}
public static int AddExchangeRetentionPolicyTag(int itemID, ExchangeRetentionPolicyTag tag)
public static IntResult AddExchangeRetentionPolicyTag(int itemID, ExchangeRetentionPolicyTag tag)
{
// place log record
TaskManager.StartTask("EXCHANGE", "ADD_EXCHANGE_RETENTIONPOLICYTAG", itemID);
IntResult res = TaskManager.StartResultTask<IntResult>("EXCHANGE", "ADD_EXCHANGE_RETENTIONPOLICYTAG", itemID);
Organization org;
try
{
org = GetOrganization(itemID);
if (org == null)
throw new ApplicationException("Organization is null");
}
catch (Exception ex)
{
TaskManager.CompleteResultTask(res, ErrorCodes.CANNOT_GET_ORGANIZATION_BY_ITEM_ID, ex);
return res;
}
try
{
Organization org = GetOrganization(itemID);
if (org == null)
return -1;
// load package context
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
if (org.PackageId > 1)
{
// quotas
}
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
int tagId = DataProvider.AddExchangeRetentionPolicyTag(itemID, tag.TagName, tag.TagType, tag.AgeLimitForRetention, tag.RetentionAction );
tag.TagID = tagId;
if (exchangeServiceId > 0)
{
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
ResultObject resTag = exchange.SetRetentionPolicyTag(tag.WSPUniqueName, (ExchangeRetentionPolicyTagType)tag.TagType, tag.AgeLimitForRetention, (ExchangeRetentionPolicyTagAction)tag.RetentionAction);
res.ErrorCodes.AddRange(resTag.ErrorCodes);
res.IsSuccess = res.IsSuccess && resTag.IsSuccess;
}
if (res.IsSuccess)
res.Value = tagId;
else
DataProvider.DeleteExchangeRetentionPolicyTag(tagId);
}
catch (Exception ex)
{
TaskManager.WriteError(ex);
TaskManager.CompleteResultTask(res);
return res;
}
TaskManager.CompleteResultTask();
return res;
}
public static ResultObject UpdateExchangeRetentionPolicyTag(int itemID, ExchangeRetentionPolicyTag tag)
{
// place log record
ResultObject res = TaskManager.StartResultTask<ResultObject>("EXCHANGE", "UPDATE_EXCHANGE_RETENTIONPOLICYTAG", itemID);
Organization org;
try
{
org = GetOrganization(itemID);
if (org == null)
throw new ApplicationException("Organization is null");
}
catch (Exception ex)
{
TaskManager.CompleteResultTask(res, ErrorCodes.CANNOT_GET_ORGANIZATION_BY_ITEM_ID, ex);
return res;
}
try
{
// load package context
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
@ -3161,99 +3243,79 @@ namespace WebsitePanel.EnterpriseServer
{
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetRetentionPolicyTag(tag.WSPUniqueName, (ExchangeRetentionPolicyTagType)tag.TagType, tag.AgeLimitForRetention, (ExchangeRetentionPolicyTagAction)tag.RetentionAction);
ResultObject resTag = exchange.SetRetentionPolicyTag(tag.WSPUniqueName, (ExchangeRetentionPolicyTagType)tag.TagType, tag.AgeLimitForRetention, (ExchangeRetentionPolicyTagAction)tag.RetentionAction);
res.ErrorCodes.AddRange(resTag.ErrorCodes);
res.IsSuccess = res.IsSuccess && resTag.IsSuccess;
}
return DataProvider.AddExchangeRetentionPolicyTag(itemID, tag.TagName, tag.TagType, tag.AgeLimitForRetention, tag.RetentionAction );
if (res.IsSuccess)
DataProvider.UpdateExchangeRetentionPolicyTag(tag.TagID, tag.ItemID, tag.TagName, tag.TagType, tag.AgeLimitForRetention, tag.RetentionAction);
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
TaskManager.WriteError(ex);
TaskManager.CompleteResultTask(res);
return res;
}
TaskManager.CompleteResultTask();
return res;
}
public static int UpdateExchangeRetentionPolicyTag(int itemID, ExchangeRetentionPolicyTag tag)
public static ResultObject DeleteExchangeRetentionPolicyTag(int itemID, int tagId)
{
// place log record
TaskManager.StartTask("EXCHANGE", "UPDATE_EXCHANGE_RETENTIONPOLICYTAG", itemID);
ResultObject res = TaskManager.StartResultTask<ResultObject>("EXCHANGE", "DELETE_EXCHANGE_RETENTIONPOLICYTAG", itemID);
Organization org;
try
{
Organization org = GetOrganization(itemID);
org = GetOrganization(itemID);
if (org == null)
return -1;
// load package context
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
if (org.PackageId > 1)
{
// 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);
throw new ApplicationException("Organization is null");
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
TaskManager.CompleteResultTask(res, ErrorCodes.CANNOT_GET_ORGANIZATION_BY_ITEM_ID, ex);
return res;
}
finally
{
TaskManager.CompleteTask();
}
return 0;
}
public static int DeleteExchangeRetentionPolicyTag(int itemID, int tagId)
{
TaskManager.StartTask("EXCHANGE", "DELETE_EXCHANGE_RETENTIONPOLICYTAG", itemID);
try
{
Organization org = GetOrganization(itemID);
if (org == null)
return -1;
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
if (exchangeServiceId > 0)
{
// load package context
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
if (org.PackageId > 1)
{
// quotas
}
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
ExchangeRetentionPolicyTag tag = GetExchangeRetentionPolicyTag(itemID, tagId);
if (tag == null) return -1;
if (tag == null) throw new ApplicationException("Tag is null");
ResultObject resTag = exchange.RemoveRetentionPolicyTag(tag.WSPUniqueName);
res.ErrorCodes.AddRange(resTag.ErrorCodes);
res.IsSuccess = res.IsSuccess && resTag.IsSuccess;
exchange.RemoveRetentionPolicyTag(tag.WSPUniqueName);
}
DataProvider.DeleteExchangeRetentionPolicyTag(tagId);
if (res.IsSuccess)
DataProvider.DeleteExchangeRetentionPolicyTag(tagId);
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
TaskManager.WriteError(ex);
TaskManager.CompleteResultTask(res);
return res;
}
TaskManager.CompleteResultTask();
return res;
}
@ -3280,7 +3342,7 @@ namespace WebsitePanel.EnterpriseServer
}
private static void UpdateExchangeMailboxPlanRetentionPolicyTags(int itemID, int policyId)
private static void UpdateExchangeRetentionPolicy(int itemID, int policyId, ResultObject result)
{
ExchangeMailboxPlan policy = GetExchangeMailboxPlan(itemID, policyId);
@ -3304,22 +3366,33 @@ namespace WebsitePanel.EnterpriseServer
{
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
exchange.SetRetentionPolicy(policy.WSPUniqueName, tagLinks.ToArray());
ResultObject res = exchange.SetRetentionPolicy(policy.WSPUniqueName, tagLinks.ToArray());
result.ErrorCodes.AddRange(res.ErrorCodes);
result.IsSuccess = result.IsSuccess && res.IsSuccess;
}
}
public static int AddExchangeMailboxPlanRetentionPolicyTag(int itemID, ExchangeMailboxPlanRetentionPolicyTag planTag)
public static IntResult AddExchangeMailboxPlanRetentionPolicyTag(int itemID, ExchangeMailboxPlanRetentionPolicyTag planTag)
{
// place log record
TaskManager.StartTask("EXCHANGE", "ADD_EXCHANGE_RETENTIONPOLICYTAG", itemID);
IntResult res = TaskManager.StartResultTask<IntResult>("EXCHANGE", "ADD_EXCHANGE_RETENTIONPOLICYTAG", itemID);
Organization org;
try
{
org = GetOrganization(itemID);
if (org == null)
throw new ApplicationException("Organization is null");
}
catch (Exception ex)
{
TaskManager.CompleteResultTask(res, ErrorCodes.CANNOT_GET_ORGANIZATION_BY_ITEM_ID, ex);
return res;
}
try
{
Organization org = GetOrganization(itemID);
if (org == null)
return -1;
// load package context
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
@ -3328,43 +3401,63 @@ namespace WebsitePanel.EnterpriseServer
// quotas
}
int res = DataProvider.AddExchangeMailboxPlanRetentionPolicyTag(planTag.TagID, planTag.MailboxPlanId);
res.Value = DataProvider.AddExchangeMailboxPlanRetentionPolicyTag(planTag.TagID, planTag.MailboxPlanId);
UpdateExchangeMailboxPlanRetentionPolicyTags(itemID, planTag.MailboxPlanId);
UpdateExchangeRetentionPolicy(itemID, planTag.MailboxPlanId, res);
return res;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
TaskManager.WriteError(ex);
TaskManager.CompleteResultTask(res);
return res;
}
TaskManager.CompleteResultTask();
return res;
}
public static int DeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int policyId, int planTagId)
public static ResultObject DeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int policyId, int planTagId)
{
TaskManager.StartTask("EXCHANGE", "DELETE_EXCHANGE_RETENTIONPOLICYTAG", itemID);
ResultObject res = TaskManager.StartResultTask<ResultObject>("EXCHANGE", "DELETE_EXCHANGE_RETENTIONPOLICYTAG", itemID);
Organization org;
try
{
DataProvider.DeleteExchangeMailboxPlanRetentionPolicyTag(planTagId);
UpdateExchangeMailboxPlanRetentionPolicyTags(itemID, policyId);
return 0;
org = GetOrganization(itemID);
if (org == null)
throw new ApplicationException("Organization is null");
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
TaskManager.CompleteResultTask(res, ErrorCodes.CANNOT_GET_ORGANIZATION_BY_ITEM_ID, ex);
return res;
}
finally
try
{
TaskManager.CompleteTask();
// load package context
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
if (org.PackageId > 1)
{
// quotas
}
DataProvider.DeleteExchangeMailboxPlanRetentionPolicyTag(planTagId);
UpdateExchangeRetentionPolicy(itemID, policyId,res);
}
catch (Exception ex)
{
TaskManager.WriteError(ex);
TaskManager.CompleteResultTask(res);
return res;
}
TaskManager.CompleteResultTask();
return res;
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2012-2014, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -579,19 +579,19 @@ namespace WebsitePanel.EnterpriseServer
}
[WebMethod]
public int AddExchangeRetentionPolicyTag(int itemId, ExchangeRetentionPolicyTag tag)
public IntResult AddExchangeRetentionPolicyTag(int itemId, ExchangeRetentionPolicyTag tag)
{
return ExchangeServerController.AddExchangeRetentionPolicyTag(itemId, tag);
}
[WebMethod]
public int UpdateExchangeRetentionPolicyTag(int itemId, ExchangeRetentionPolicyTag tag)
public ResultObject UpdateExchangeRetentionPolicyTag(int itemId, ExchangeRetentionPolicyTag tag)
{
return ExchangeServerController.UpdateExchangeRetentionPolicyTag(itemId, tag);
}
[WebMethod]
public int DeleteExchangeRetentionPolicyTag(int itemId, int tagId)
public ResultObject DeleteExchangeRetentionPolicyTag(int itemId, int tagId)
{
return ExchangeServerController.DeleteExchangeRetentionPolicyTag(itemId, tagId);
}
@ -604,13 +604,13 @@ namespace WebsitePanel.EnterpriseServer
}
[WebMethod]
public int AddExchangeMailboxPlanRetentionPolicyTag(int itemId, ExchangeMailboxPlanRetentionPolicyTag planTag)
public IntResult AddExchangeMailboxPlanRetentionPolicyTag(int itemId, ExchangeMailboxPlanRetentionPolicyTag planTag)
{
return ExchangeServerController.AddExchangeMailboxPlanRetentionPolicyTag(itemId, planTag);
}
[WebMethod]
public int DeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int policyId, int planTagId)
public ResultObject DeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int policyId, int planTagId)
{
return ExchangeServerController.DeleteExchangeMailboxPlanRetentionPolicyTag(itemID, policyId, planTagId);
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// 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
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using WebsitePanel.Providers.Common;
namespace WebsitePanel.Providers.HostedSolution
{
public interface IExchangeServer
@ -132,12 +134,12 @@ namespace WebsitePanel.Providers.HostedSolution
int RemoveTransportRule(string Name);
// Archiving
void SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy);
ResultObject 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);
ResultObject SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction);
ResultObject RemoveRetentionPolicyTag(string Identity);
ResultObject SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks);
ResultObject RemoveRetentionPolicy(string Identity);
}
}

View file

@ -48,6 +48,8 @@ using WebsitePanel.Providers;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.Utils;
using WebsitePanel.Server.Utils;
using WebsitePanel.Providers.Common;
using Microsoft.Exchange.Data.Directory.Recipient;
using Microsoft.Win32;
@ -6043,6 +6045,25 @@ namespace WebsitePanel.Providers.HostedSolution
return ExecuteShellCommand(runSpace, cmd, useDomainController, out errors);
}
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, ResultObject res)
{
return ExecuteShellCommand(runSpace, cmd, res, true);
}
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, ResultObject res, bool setIsSuccess)
{
object[] errors;
Collection<PSObject> ret = ExecuteShellCommand(runSpace, cmd, out errors);
if (errors.Length>0)
{
foreach (object error in errors)
res.ErrorCodes.Add(error.ToString());
if (setIsSuccess)
res.IsSuccess = false;
}
return ret;
}
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, out object[] errors)
{
return ExecuteShellCommand(runSpace, cmd, true, out errors);
@ -7253,16 +7274,18 @@ namespace WebsitePanel.Providers.HostedSolution
#region Archiving
public void SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
public ResultObject SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
{
SetMailBoxArchivingInternal(organizationId, accountName, archive, archiveQuotaKB, archiveWarningQuotaKB, RetentionPolicy);
return SetMailBoxArchivingInternal(organizationId, accountName, archive, archiveQuotaKB, archiveWarningQuotaKB, RetentionPolicy);
}
private void SetMailBoxArchivingInternal(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
private ResultObject SetMailBoxArchivingInternal(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
{
ExchangeLog.LogStart("SetMailBoxArchivingInternal");
ExchangeLog.DebugInfo("Account: {0}", accountName);
ResultObject res = new ResultObject() { IsSuccess=true };
Runspace runSpace = null;
Runspace runSpaceEx = null;
try
@ -7283,20 +7306,21 @@ namespace WebsitePanel.Providers.HostedSolution
{
cmd.Parameters.Add("ArchiveDatabase", database);
}
ExecuteShellCommand(runSpace, cmd);
ExecuteShellCommand(runSpace, cmd, res);
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);
ExecuteShellCommand(runSpace, cmd, res);
}
else
{
cmd = new Command("Disable-Mailbox");
cmd.Parameters.Add("Identity", accountName);
cmd.Parameters.Add("Archive");
ExecuteShellCommand(runSpace, cmd);
ExecuteShellCommand(runSpace, cmd, res);
}
if (!String.IsNullOrEmpty(RetentionPolicy))
@ -7304,18 +7328,20 @@ namespace WebsitePanel.Providers.HostedSolution
cmd = new Command("Set-Mailbox");
cmd.Parameters.Add("Identity", accountName);
cmd.Parameters.Add("RetentionPolicy", RetentionPolicy);
ExecuteShellCommand(runSpace, cmd);
ExecuteShellCommand(runSpace, cmd, res);
}
}
finally
{
CloseRunspace(runSpace);
CloseRunspaceEx(runSpaceEx);
}
ExchangeLog.LogEnd("SetMailBoxArchivingInternal");
return res;
}
@ -7323,15 +7349,17 @@ namespace WebsitePanel.Providers.HostedSolution
#region Retention policy
public void SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention , ExchangeRetentionPolicyTagAction RetentionAction)
public ResultObject SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
{
SetRetentionPolicyTagInternal(Identity, Type, AgeLimitForRetention, RetentionAction);
return SetRetentionPolicyTagInternal(Identity, Type, AgeLimitForRetention, RetentionAction);
}
private void SetRetentionPolicyTagInternal(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
private ResultObject SetRetentionPolicyTagInternal(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
{
ExchangeLog.LogStart("SetRetentionPolicyTagInternal");
ResultObject res = new ResultObject() { IsSuccess = true };
Runspace runSpace = null;
Runspace runSpaceEx = null;
try
@ -7344,11 +7372,13 @@ namespace WebsitePanel.Providers.HostedSolution
bool exists = false;
cmd = new Command("Get-RetentionPolicyTag");
cmd.Parameters.Add("Identity", Identity);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd, res, false);
if (result != null && result.Count > 0)
exists = true;
res = new ResultObject() { IsSuccess = true };
if (exists)
{
cmd = new Command("Set-RetentionPolicyTag");
@ -7365,8 +7395,7 @@ namespace WebsitePanel.Providers.HostedSolution
cmd.Parameters.Add("RetentionAction", Enum.GetName(typeof(ExchangeRetentionPolicyTagAction), RetentionAction));
cmd.Parameters.Add("RetentionEnabled", true);
object[] errors;
result = ExecuteShellCommand(runSpace, cmd,out errors);
result = ExecuteShellCommand(runSpace, cmd, res);
}
finally
{
@ -7375,17 +7404,21 @@ namespace WebsitePanel.Providers.HostedSolution
CloseRunspaceEx(runSpaceEx);
}
ExchangeLog.LogEnd("SetRetentionPolicyTagInternal");
return res;
}
public void RemoveRetentionPolicyTag(string Identity)
public ResultObject RemoveRetentionPolicyTag(string Identity)
{
RemoveRetentionPolicyTagInternal(Identity);
return RemoveRetentionPolicyTagInternal(Identity);
}
private void RemoveRetentionPolicyTagInternal(string Identity)
private ResultObject RemoveRetentionPolicyTagInternal(string Identity)
{
ExchangeLog.LogStart("RemoveRetentionPolicyTagInternal");
ResultObject res = new ResultObject() { IsSuccess = true };
Runspace runSpace = null;
Runspace runSpaceEx = null;
try
@ -7395,10 +7428,9 @@ namespace WebsitePanel.Providers.HostedSolution
Command cmd;
bool exists = false;
cmd = new Command("Remove-RetentionPolicyTag");
cmd.Parameters.Add("Identity", Identity);
ExecuteShellCommand(runSpace, cmd);
ExecuteShellCommand(runSpace, cmd, res);
}
finally
{
@ -7407,17 +7439,21 @@ namespace WebsitePanel.Providers.HostedSolution
CloseRunspaceEx(runSpaceEx);
}
ExchangeLog.LogEnd("RemoveRetentionPolicyTagInternal");
return res;
}
public void SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks)
public ResultObject SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks)
{
SetRetentionPolicyInternal(Identity, RetentionPolicyTagLinks);
return SetRetentionPolicyInternal(Identity, RetentionPolicyTagLinks);
}
private void SetRetentionPolicyInternal(string Identity, string[] RetentionPolicyTagLinks)
private ResultObject SetRetentionPolicyInternal(string Identity, string[] RetentionPolicyTagLinks)
{
ExchangeLog.LogStart("SetRetentionPolicyInternal");
ResultObject res = new ResultObject() { IsSuccess = true };
Runspace runSpace = null;
Runspace runSpaceEx = null;
try
@ -7430,11 +7466,13 @@ namespace WebsitePanel.Providers.HostedSolution
bool exists = false;
cmd = new Command("Get-RetentionPolicy");
cmd.Parameters.Add("Identity", Identity);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd, res, false);
if (result != null && result.Count > 0)
exists = true;
res = new ResultObject() { IsSuccess = true };
if (exists)
{
cmd = new Command("Set-RetentionPolicy");
@ -7448,7 +7486,7 @@ namespace WebsitePanel.Providers.HostedSolution
cmd.Parameters.Add("RetentionPolicyTagLinks", RetentionPolicyTagLinks);
result = ExecuteShellCommand(runSpace, cmd);
result = ExecuteShellCommand(runSpace, cmd, res);
}
finally
{
@ -7457,17 +7495,21 @@ namespace WebsitePanel.Providers.HostedSolution
CloseRunspaceEx(runSpaceEx);
}
ExchangeLog.LogEnd("SetRetentionPolicyInternal");
return res;
}
public void RemoveRetentionPolicy(string Identity)
public ResultObject RemoveRetentionPolicy(string Identity)
{
RemoveRetentionPolicyInternal(Identity);
return RemoveRetentionPolicyInternal(Identity);
}
private void RemoveRetentionPolicyInternal(string Identity)
private ResultObject RemoveRetentionPolicyInternal(string Identity)
{
ExchangeLog.LogStart("RemoveRetentionPolicyInternal");
ResultObject res = new ResultObject() { IsSuccess = true };
Runspace runSpace = null;
Runspace runSpaceEx = null;
try
@ -7479,15 +7521,16 @@ namespace WebsitePanel.Providers.HostedSolution
cmd = new Command("Remove-RetentionPolicy");
cmd.Parameters.Add("Identity", Identity);
ExecuteShellCommand(runSpace, cmd);
ExecuteShellCommand(runSpace, cmd, res);
}
finally
{
CloseRunspace(runSpace);
CloseRunspaceEx(runSpaceEx);
}
ExchangeLog.LogEnd("RemoveRetentionPolicyInternal");
return res;
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -44,6 +44,7 @@ using System.Management.Automation;
using System.Management.Automation.Runspaces;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.Utils;
using WebsitePanel.Server.Utils;
@ -6967,32 +6968,37 @@ namespace WebsitePanel.Providers.HostedSolution
#endregion
#region Archiving
public virtual void SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
public virtual ResultObject SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
{
// not implemented
return null;
}
#endregion
#region Retention policy
public virtual void SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
public virtual ResultObject SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
{
// not implemented
return null;
}
public virtual void RemoveRetentionPolicyTag(string Identity)
public virtual ResultObject RemoveRetentionPolicyTag(string Identity)
{
// not implemented
return null;
}
public virtual void SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks)
public virtual ResultObject SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks)
{
// not implemented
return null;
}
public virtual void RemoveRetentionPolicy(string Identity)
public virtual ResultObject RemoveRetentionPolicy(string Identity)
{
// not implemented
return null;
}

View file

@ -27,6 +27,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.Common;
//------------------------------------------------------------------------------
// <auto-generated>
@ -853,15 +854,16 @@ 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)
public ResultObject SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
{
this.Invoke("SetMailBoxArchiving", new object[] {
object[] results = this.Invoke("SetMailBoxArchiving", new object[] {
organizationId,
accountName,
archive,
archiveQuotaKB,
archiveWarningQuotaKB,
RetentionPolicy});
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -877,9 +879,10 @@ namespace WebsitePanel.Providers.Exchange
}
/// <remarks/>
public void EndSetMailBoxArchiving(System.IAsyncResult asyncResult)
public ResultObject EndSetMailBoxArchiving(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -909,20 +912,21 @@ namespace WebsitePanel.Providers.Exchange
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));
this.SetMailBoxArchivingCompleted(this, new SetMailBoxArchivingCompletedEventArgs(invokeArgs.Results, 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)
public ResultObject SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
{
this.Invoke("SetRetentionPolicyTag", new object[] {
object[] results = this.Invoke("SetRetentionPolicyTag", new object[] {
Identity,
Type,
AgeLimitForRetention,
RetentionAction});
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -936,9 +940,10 @@ namespace WebsitePanel.Providers.Exchange
}
/// <remarks/>
public void EndSetRetentionPolicyTag(System.IAsyncResult asyncResult)
public ResultObject EndSetRetentionPolicyTag(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -966,17 +971,18 @@ namespace WebsitePanel.Providers.Exchange
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));
this.SetRetentionPolicyTagCompleted(this, new SetRetentionPolicyTagCompletedEventArgs(invokeArgs.Results, 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)
public ResultObject RemoveRetentionPolicyTag(string Identity)
{
this.Invoke("RemoveRetentionPolicyTag", new object[] {
object[] results = this.Invoke("RemoveRetentionPolicyTag", new object[] {
Identity});
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -987,9 +993,10 @@ namespace WebsitePanel.Providers.Exchange
}
/// <remarks/>
public void EndRemoveRetentionPolicyTag(System.IAsyncResult asyncResult)
public ResultObject EndRemoveRetentionPolicyTag(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -1014,18 +1021,19 @@ namespace WebsitePanel.Providers.Exchange
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));
this.RemoveRetentionPolicyTagCompleted(this, new RemoveRetentionPolicyTagCompletedEventArgs(invokeArgs.Results, 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)
public ResultObject SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks)
{
this.Invoke("SetRetentionPolicy", new object[] {
object[] results = this.Invoke("SetRetentionPolicy", new object[] {
Identity,
RetentionPolicyTagLinks});
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -1037,9 +1045,10 @@ namespace WebsitePanel.Providers.Exchange
}
/// <remarks/>
public void EndSetRetentionPolicy(System.IAsyncResult asyncResult)
public ResultObject EndSetRetentionPolicy(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -1065,17 +1074,18 @@ namespace WebsitePanel.Providers.Exchange
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));
this.SetRetentionPolicyCompleted(this, new SetRetentionPolicyCompletedEventArgs(invokeArgs.Results, 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)
public ResultObject RemoveRetentionPolicy(string Identity)
{
this.Invoke("RemoveRetentionPolicy", new object[] {
object[] results = this.Invoke("RemoveRetentionPolicy", new object[] {
Identity});
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -1086,9 +1096,10 @@ namespace WebsitePanel.Providers.Exchange
}
/// <remarks/>
public void EndRemoveRetentionPolicy(System.IAsyncResult asyncResult)
public ResultObject EndRemoveRetentionPolicy(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
@ -1113,7 +1124,7 @@ namespace WebsitePanel.Providers.Exchange
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));
this.RemoveRetentionPolicyCompleted(this, new RemoveRetentionPolicyCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
@ -5082,23 +5093,153 @@ namespace WebsitePanel.Providers.Exchange
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void SetMailBoxArchivingCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
public delegate void SetMailBoxArchivingCompletedEventHandler(object sender, SetMailBoxArchivingCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void SetRetentionPolicyTagCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SetMailBoxArchivingCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal SetMailBoxArchivingCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public ResultObject Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((ResultObject)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void RemoveRetentionPolicyTagCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
public delegate void SetRetentionPolicyTagCompletedEventHandler(object sender, SetRetentionPolicyTagCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void SetRetentionPolicyCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SetRetentionPolicyTagCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal SetRetentionPolicyTagCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public ResultObject Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((ResultObject)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void RemoveRetentionPolicyCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
public delegate void RemoveRetentionPolicyTagCompletedEventHandler(object sender, RemoveRetentionPolicyTagCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class RemoveRetentionPolicyTagCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal RemoveRetentionPolicyTagCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public ResultObject Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((ResultObject)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void SetRetentionPolicyCompletedEventHandler(object sender, SetRetentionPolicyCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SetRetentionPolicyCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal SetRetentionPolicyCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public ResultObject Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((ResultObject)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void RemoveRetentionPolicyCompletedEventHandler(object sender, RemoveRetentionPolicyCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class RemoveRetentionPolicyCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal RemoveRetentionPolicyCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public ResultObject Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((ResultObject)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -34,6 +34,7 @@ using WebsitePanel.Providers;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Server.Utils;
using Microsoft.Web.Services3;
using WebsitePanel.Providers.Common;
namespace WebsitePanel.Server
{
@ -1219,12 +1220,13 @@ namespace WebsitePanel.Server
#region Archiving
[WebMethod, SoapHeader("settings")]
public void SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
public ResultObject SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
{
ResultObject res = null;
try
{
LogStart("SetMailBoxArchiving");
ES.SetMailBoxArchiving(organizationId, accountName, archive, archiveQuotaKB, archiveWarningQuotaKB, RetentionPolicy);
res = ES.SetMailBoxArchiving(organizationId, accountName, archive, archiveQuotaKB, archiveWarningQuotaKB, RetentionPolicy);
LogEnd("SetMailBoxArchiving");
}
catch (Exception ex)
@ -1232,18 +1234,21 @@ namespace WebsitePanel.Server
LogError("SetMailBoxArchiving", ex);
throw;
}
return res;
}
#endregion
#region Retention policy
[WebMethod, SoapHeader("settings")]
public void SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
public ResultObject SetRetentionPolicyTag(string Identity, ExchangeRetentionPolicyTagType Type, int AgeLimitForRetention, ExchangeRetentionPolicyTagAction RetentionAction)
{
ResultObject res = null;
try
{
LogStart("SetRetentionPolicyTag");
ES.SetRetentionPolicyTag(Identity, Type, AgeLimitForRetention, RetentionAction);
res = ES.SetRetentionPolicyTag(Identity, Type, AgeLimitForRetention, RetentionAction);
LogEnd("SetRetentionPolicyTag");
}
catch (Exception ex)
@ -1251,16 +1256,17 @@ namespace WebsitePanel.Server
LogError("SetRetentionPolicyTag", ex);
throw;
}
return res;
}
[WebMethod, SoapHeader("settings")]
public void RemoveRetentionPolicyTag(string Identity)
public ResultObject RemoveRetentionPolicyTag(string Identity)
{
ResultObject res = null;
try
{
LogStart("RemoveRetentionPolicyTag");
ES.RemoveRetentionPolicyTag(Identity);
res = ES.RemoveRetentionPolicyTag(Identity);
LogEnd("RemoveRetentionPolicyTag");
}
catch (Exception ex)
@ -1268,16 +1274,17 @@ namespace WebsitePanel.Server
LogError("RemoveRetentionPolicyTag", ex);
throw;
}
return res;
}
[WebMethod, SoapHeader("settings")]
public void SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks)
public ResultObject SetRetentionPolicy(string Identity, string[] RetentionPolicyTagLinks)
{
ResultObject res = null;
try
{
LogStart("SetRetentionPolicy");
ES.SetRetentionPolicy(Identity, RetentionPolicyTagLinks);
res = ES.SetRetentionPolicy(Identity, RetentionPolicyTagLinks);
LogEnd("SetRetentionPolicy");
}
catch (Exception ex)
@ -1285,16 +1292,17 @@ namespace WebsitePanel.Server
LogError("SetRetentionPolicy", ex);
throw;
}
return res;
}
[WebMethod, SoapHeader("settings")]
public void RemoveRetentionPolicy(string Identity)
public ResultObject RemoveRetentionPolicy(string Identity)
{
ResultObject res = null;
try
{
LogStart("RemoveRetentionPolicy");
ES.RemoveRetentionPolicy(Identity);
res = ES.RemoveRetentionPolicy(Identity);
LogEnd("RemoveRetentionPolicy");
}
catch (Exception ex)
@ -1302,7 +1310,7 @@ namespace WebsitePanel.Server
LogError("RemoveRetentionPolicy", ex);
throw;
}
return res;
}
#endregion

View file

@ -5437,4 +5437,16 @@
<data name="Quota.Exchange2013.ArchivingStorage" xml:space="preserve">
<value>Archiving storage, MB</value>
</data>
<data name="Error.EXCHANGE_DELETE_RETENTIONPOLICY" xml:space="preserve">
<value>Unable to delete Retention policy.</value>
</data>
<data name="Error.EXCHANGE_UPDATERETENTIONPOLICY" xml:space="preserve">
<value>Retention policy update failed</value>
</data>
<data name="Success.EXCHANGE_DELETE_RETENTIONPOLICY" xml:space="preserve">
<value>Retention policy deleted.</value>
</data>
<data name="Success.EXCHANGE_UPDATERETENTIONPOLICY" xml:space="preserve">
<value>Retention policy updated</value>
</data>
</root>

View file

@ -246,4 +246,7 @@
<data name="lblLitigationHoldUrl.Text" xml:space="preserve">
<value>Litigation Hold Url:</value>
</data>
<data name="secRetentionPolicy.Text" xml:space="preserve">
<value>Retention policy</value>
</data>
</root>

View file

@ -165,4 +165,7 @@
<data name="locTitleRetentionPolicy.Text" xml:space="preserve">
<value>Retention Policy</value>
</data>
<data name="Text.PageRetentionPolicyName" xml:space="preserve">
<value>Retention policy</value>
</data>
</root>

View file

@ -37,6 +37,7 @@ using System.Web.UI.HtmlControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.Providers.Common;
namespace WebsitePanel.Portal.ExchangeServer
{
@ -293,10 +294,10 @@ namespace WebsitePanel.Portal.ExchangeServer
foreach(ExchangeMailboxPlanRetentionPolicyTag tag in tags)
{
tag.MailboxPlanId = planId;
int result = ES.Services.ExchangeServer.AddExchangeMailboxPlanRetentionPolicyTag(PanelRequest.ItemID, tag);
if (result < 0)
IntResult result = ES.Services.ExchangeServer.AddExchangeMailboxPlanRetentionPolicyTag(PanelRequest.ItemID, tag);
if (!result.IsSuccess)
{
messageBox.ShowResultMessage(result);
messageBox.ShowMessage(result, "EXCHANGE_ADD_MAILBOXPLAN", null);
return;
}
}

View file

@ -4,6 +4,8 @@
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/PasswordControl.ascx" TagName="PasswordControl" TagPrefix="wsp" %>
<%@ Register Src="UserControls/EmailAddress.ascx" TagName="EmailAddress" TagPrefix="wsp" %>
<%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %>
<%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<%@ Register Src="UserControls/MailboxPlanSelector.ascx" TagName="MailboxPlanSelector" TagPrefix="wsp" %>
@ -28,7 +30,11 @@
<div id="ExchangeContainer">
<div class="Module">
<div class="Header">
<wsp:Breadcrumb id="breadcrumb" runat="server" PageName="Text.PageName" />
</div>
<div class="Left">
<wsp:Menu id="menu" runat="server" SelectedItem="mailboxes" />
</div>
<div class="Content">
<div class="Center">
@ -139,7 +145,7 @@
<wsp:MailboxPlanSelector ID="mailboxPlanSelector" runat="server" Archiving="false" />
</td>
</tr>
<tr>
<tr id="rowRetentionPolicy" runat="server">
<td class="FormLabel150">
<asp:Localize ID="locRetentionPolicyName" runat="server" meta:resourcekey="locRetentionPolicyName" Text="Retention policy Name: "></asp:Localize>
</td>

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -99,6 +99,8 @@ namespace WebsitePanel.Portal.ExchangeServer
rbMailboxType.Items.Add(new System.Web.UI.WebControls.ListItem(GetLocalizedString("EquipmentMailbox.Text"), "6"));
}
}
rowRetentionPolicy.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, cntx);
}
}

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.
@ -58,6 +30,24 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divWrapper;
/// <summary>
/// breadcrumb 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.Breadcrumb breadcrumb;
/// <summary>
/// menu 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.Menu menu;
/// <summary>
/// Image1 control.
/// </summary>
@ -337,6 +327,15 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelector;
/// <summary>
/// rowRetentionPolicy 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 rowRetentionPolicy;
/// <summary>
/// locRetentionPolicyName control.
/// </summary>

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2012-2014, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -80,6 +80,9 @@ namespace WebsitePanel.Portal.ExchangeServer
secLitigationHoldSettings.Visible = (Utils.CheckQouta(Quotas.EXCHANGE2007_ALLOWLITIGATIONHOLD, Cntx));
}
secRetentionPolicy.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, cntx);
}
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2012-2014, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -47,6 +47,7 @@ namespace WebsitePanel.Portal.ExchangeServer
protected void Page_Load(object sender, EventArgs e)
{
locTitle.Text = RetentionPolicy ? GetLocalizedString("locTitleRetentionPolicy.Text") : GetLocalizedString("locTitle.Text");
breadcrumb.PageName = RetentionPolicy ? "Text.PageRetentionPolicyName" : "Text.PageName";
gvMailboxPlans.Columns[2].Visible = !RetentionPolicy;
btnSetDefaultMailboxPlan.Visible = !RetentionPolicy;

View file

@ -92,7 +92,7 @@
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locAgeLimitForRetention" runat="server" meta:resourcekey="locAgeLimitForRetention" Text="Age limit ror retention :"></asp:Localize></td>
<td class="FormLabel200" align="right"><asp:Localize ID="locAgeLimitForRetention" runat="server" meta:resourcekey="locAgeLimitForRetention" Text="Age limit for retention :"></asp:Localize></td>
<td>
<div class="Right">
<uc1:QuotaEditor id="ageLimitForRetention" runat="server"
@ -126,6 +126,11 @@
<asp:Button ID="btnUpdatePolicy" runat="server" meta:resourcekey="btnUpdatePolicy"
Text="Update" CssClass="Button1" OnClick="btnUpdatePolicy_Click" />
</td>
<td>
<div class="FormButtonsBarClean">
<asp:Button ID="btnCancelPolicy" runat="server" meta:resourcekey="btnCancelPolicy"
Text="Cancel" CssClass="Button1" OnClick="btnCancelPolicy_Click"/>
</td>
</tr>
</table>

View file

@ -47,6 +47,8 @@ using System.Web.UI.HtmlControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.ResultObjects;
namespace WebsitePanel.Portal.ExchangeServer
{
@ -70,6 +72,8 @@ namespace WebsitePanel.Portal.ExchangeServer
ddRetentionAction.Items.Clear();
for (int i = 0; i < action.Length; i++)
ddRetentionAction.Items.Add(new ListItem(action[i], i.ToString()));
ClearEditValues();
}
txtStatus.Visible = false;
@ -83,8 +87,6 @@ namespace WebsitePanel.Portal.ExchangeServer
gvPolicy.DataSource = list;
gvPolicy.DataBind();
btnUpdatePolicy.Enabled = (string.IsNullOrEmpty(txtPolicy.Text)) ? false : true;
}
@ -101,15 +103,20 @@ namespace WebsitePanel.Portal.ExchangeServer
tag.AgeLimitForRetention = ageLimitForRetention.QuotaValue;
tag.RetentionAction = Convert.ToInt32(ddRetentionAction.SelectedValue);
int result = ES.Services.ExchangeServer.AddExchangeRetentionPolicyTag(PanelRequest.ItemID, tag);
IntResult result = ES.Services.ExchangeServer.AddExchangeRetentionPolicyTag(PanelRequest.ItemID, tag);
if (result < 0)
if (!result.IsSuccess)
{
ShowResultMessage(result);
messageBox.ShowMessage(result, "EXCHANGE_UPDATERETENTIONPOLICY", null);
return;
}
else
{
messageBox.ShowSuccessMessage("EXCHANGE_UPDATERETENTIONPOLICY");
}
BindRetentionPolicy();
ClearEditValues();
}
protected void gvPolicy_RowCommand(object sender, GridViewCommandEventArgs e)
@ -132,24 +139,25 @@ namespace WebsitePanel.Portal.ExchangeServer
}
int result = ES.Services.ExchangeServer.DeleteExchangeRetentionPolicyTag(PanelRequest.ItemID, mailboxPlanId);
if (result < 0)
ResultObject result = ES.Services.ExchangeServer.DeleteExchangeRetentionPolicyTag(PanelRequest.ItemID, mailboxPlanId);
if (!result.IsSuccess)
{
ShowResultMessage(result);
messageBox.ShowMessage(result, "EXCHANGE_DELETE_RETENTIONPOLICY", null);
return;
}
else
{
messageBox.ShowSuccessMessage("EXCHANGE_DELETE_RETENTIONPOLICY");
}
ViewState["PolicyID"] = null;
txtPolicy.Text = string.Empty;
ageLimitForRetention.QuotaValue = 0;
btnUpdatePolicy.Enabled = (string.IsNullOrEmpty(txtPolicy.Text)) ? false : true;
ClearEditValues();
}
catch (Exception)
{
ShowErrorMessage("EXCHANGE_DELETE_MAILBOXPLAN");
ShowErrorMessage("EXCHANGE_DELETE_RETENTIONPOLICY");
}
BindRetentionPolicy();
@ -165,7 +173,12 @@ namespace WebsitePanel.Portal.ExchangeServer
ageLimitForRetention.QuotaValue = tag.AgeLimitForRetention;
Utils.SelectListItem(ddRetentionAction, tag.RetentionAction);
btnUpdatePolicy.Enabled = (string.IsNullOrEmpty(txtPolicy.Text)) ? false : true;
btnUpdatePolicy.Enabled = true;
btnCancelPolicy.Enabled = true;
btnAddPolicy.Enabled = false;
ddTagType.Enabled = false;
break;
}
@ -202,15 +215,15 @@ namespace WebsitePanel.Portal.ExchangeServer
tag.AgeLimitForRetention = ageLimitForRetention.QuotaValue;
tag.RetentionAction = Convert.ToInt32(ddRetentionAction.SelectedValue);
int result = ES.Services.ExchangeServer.UpdateExchangeRetentionPolicyTag(PanelRequest.ItemID, tag);
ResultObject result = ES.Services.ExchangeServer.UpdateExchangeRetentionPolicyTag(PanelRequest.ItemID, tag);
if (result < 0)
if (!result.IsSuccess)
{
ShowErrorMessage("EXCHANGE_UPDATEPLANS");
messageBox.ShowMessage(result,"EXCHANGE_UPDATERETENTIONPOLICY", null);
}
else
{
ShowSuccessMessage("EXCHANGE_UPDATEPLANS");
messageBox.ShowSuccessMessage("EXCHANGE_UPDATERETENTIONPOLICY");
}
BindRetentionPolicy();
@ -234,5 +247,22 @@ namespace WebsitePanel.Portal.ExchangeServer
return GetThemedImage("Exchange/" + imgName);
}
protected void ClearEditValues()
{
txtPolicy.Text = string.Empty;
ageLimitForRetention.QuotaValue = 0;
ddTagType.Enabled = true;
btnAddPolicy.Enabled = true;
btnUpdatePolicy.Enabled = false;
btnCancelPolicy.Enabled = false;
}
protected void btnCancelPolicy_Click(object sender, EventArgs e)
{
ClearEditValues();
}
}
}

View file

@ -192,6 +192,15 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnUpdatePolicy;
/// <summary>
/// btnCancelPolicy 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 btnCancelPolicy;
/// <summary>
/// txtStatus control.
/// </summary>

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2012-2014, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -120,7 +120,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
if (Utils.CheckQouta(Quotas.EXCHANGE2007_MAILBOXES, cntx))
exchangeGroup.MenuItems.Add(CreateMenuItem("Mailboxes", "mailboxes"));
if (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx))
if (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, cntx))
exchangeGroup.MenuItems.Add(CreateMenuItem("ArchivingMailboxes", "archivingmailboxes"));
if (Utils.CheckQouta(Quotas.EXCHANGE2007_CONTACTS, cntx))
@ -141,11 +141,11 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
exchangeGroup.MenuItems.Add(CreateMenuItem("MailboxPlans", "mailboxplans"));
if (!hideItems)
if (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx))
if (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, cntx))
exchangeGroup.MenuItems.Add(CreateMenuItem("RetentionPolicy", "retentionpolicy"));
if (!hideItems)
if (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx))
if (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY, cntx))
exchangeGroup.MenuItems.Add(CreateMenuItem("RetentionPolicyTag", "retentionpolicytag"));
if (!hideItems)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014, Outercurve Foundation.
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
@ -47,6 +47,8 @@ using System.Web.UI.HtmlControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.Providers.Common;
namespace WebsitePanel.Portal
{
@ -64,6 +66,8 @@ namespace WebsitePanel.Portal
public void BindSettings(UserSettings settings)
{
secMailboxPlan.Text = RetentionPolicy ? GetLocalizedString("secRetentionPolicy.Text") : GetLocalizedString("secMailboxPlan.Text");
BindMailboxPlans();
txtStatus.Visible = false;
@ -497,9 +501,12 @@ namespace WebsitePanel.Portal
else
{
if (RetentionPolicy)
SaveTags(orgs[0].Id, mailboxPlanId);
messageBox.ShowSuccessMessage("EXCHANGE_UPDATEPLANS");
{
if (SaveTags(orgs[0].Id, mailboxPlanId))
messageBox.ShowSuccessMessage("EXCHANGE_UPDATEPLANS");
}
else
messageBox.ShowSuccessMessage("EXCHANGE_UPDATEPLANS");
}
}
@ -684,11 +691,19 @@ namespace WebsitePanel.Portal
}
}
protected void SaveTags(int ItemId, int planId)
protected bool 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);
{
ResultObject res = ES.Services.ExchangeServer.DeleteExchangeMailboxPlanRetentionPolicyTag(ItemId, planId, tag.PlanTagID);
if (!res.IsSuccess)
{
messageBox.ShowMessage(res, "EXCHANGE_UPDATEPLANS", null);
return false;
}
}
List<ExchangeMailboxPlanRetentionPolicyTag> tags = ViewState["Tags"] as List<ExchangeMailboxPlanRetentionPolicyTag>;
if (tags != null)
@ -696,15 +711,17 @@ namespace WebsitePanel.Portal
foreach (ExchangeMailboxPlanRetentionPolicyTag tag in tags)
{
tag.MailboxPlanId = planId;
int result = ES.Services.ExchangeServer.AddExchangeMailboxPlanRetentionPolicyTag(ItemId, tag);
if (result < 0)
IntResult res = ES.Services.ExchangeServer.AddExchangeMailboxPlanRetentionPolicyTag(ItemId, tag);
if (!res.IsSuccess)
{
messageBox.ShowResultMessage(result);
return;
messageBox.ShowMessage(res, "EXCHANGE_UPDATEPLANS", null);
return false;
}
}
}
return true;
}
}

View file

@ -65,7 +65,7 @@
</td>
</tr>
<tr>
<td class="FormLabel200" align="right"><asp:Localize ID="locAgeLimitForRetention" runat="server" meta:resourcekey="locAgeLimitForRetention" Text="Age limit ror retention :"></asp:Localize></td>
<td class="FormLabel200" align="right"><asp:Localize ID="locAgeLimitForRetention" runat="server" meta:resourcekey="locAgeLimitForRetention" Text="Age limit for retention :"></asp:Localize></td>
<td>
<div class="Right">
<uc1:QuotaEditor id="ageLimitForRetention" runat="server"

View file

@ -47,6 +47,8 @@ using System.Web.UI.HtmlControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.ResultObjects;
namespace WebsitePanel.Portal
{
@ -136,13 +138,17 @@ namespace WebsitePanel.Portal
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
int result = ES.Services.ExchangeServer.AddExchangeRetentionPolicyTag(orgs[0].Id, tag);
IntResult result = ES.Services.ExchangeServer.AddExchangeRetentionPolicyTag(orgs[0].Id, tag);
if (result < 0)
if (!result.IsSuccess)
{
messageBox.ShowResultMessage(result);
messageBox.ShowMessage(result, "EXCHANGE_UPDATEPLANS", null);
return;
}
else
{
messageBox.ShowSuccessMessage("EXCHANGE_UPDATEPLANS");
}
}
BindRetentionPolicy();
@ -185,12 +191,16 @@ namespace WebsitePanel.Portal
}
int result = ES.Services.ExchangeServer.DeleteExchangeRetentionPolicyTag(orgs[0].Id, mailboxPlanId);
if (result < 0)
ResultObject result = ES.Services.ExchangeServer.DeleteExchangeRetentionPolicyTag(orgs[0].Id, mailboxPlanId);
if (!result.IsSuccess)
{
messageBox.ShowResultMessage(result);
messageBox.ShowMessage(result, "EXCHANGE_DELETE_RETENTIONPOLICY", null);
return;
}
else
{
messageBox.ShowSuccessMessage("EXCHANGE_DELETE_RETENTIONPOLICY");
}
ViewState["PolicyID"] = null;
@ -202,7 +212,7 @@ namespace WebsitePanel.Portal
}
catch (Exception)
{
messageBox.ShowErrorMessage("EXCHANGE_DELETE_MAILBOXPLAN");
messageBox.ShowErrorMessage("EXCHANGE_DELETE_RETENTIONPOLICY");
}
BindRetentionPolicy();
@ -288,11 +298,11 @@ namespace WebsitePanel.Portal
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
int result = ES.Services.ExchangeServer.UpdateExchangeRetentionPolicyTag(orgs[0].Id, tag);
ResultObject result = ES.Services.ExchangeServer.UpdateExchangeRetentionPolicyTag(orgs[0].Id, tag);
if (result < 0)
if (!result.IsSuccess)
{
messageBox.ShowErrorMessage("EXCHANGE_UPDATEPLANS");
messageBox.ShowMessage(result, "EXCHANGE_UPDATEPLANS", null);
}
else
{