From ae91a184050dac249f6e10c17b09d1267878461a Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Tue, 22 Apr 2014 18:39:33 +0400 Subject: [PATCH] Fix archiving --- .../Packages/Quotas.cs | 4 +- .../ExchangeServerProxy.cs | 66 ++-- .../ExchangeServerController.cs | 287 ++++++++++++------ .../esExchangeServer.asmx.cs | 12 +- .../HostedSolution/IExchangeServer.cs | 14 +- .../Exchange2013.cs | 107 +++++-- .../Exchange2007.cs | 18 +- .../ExchangeServerProxy.cs | 201 ++++++++++-- .../ExchangeServer.asmx.cs | 38 ++- .../WebsitePanel_SharedResources.ascx.resx | 12 + ...ttingsExchangeMailboxPlansPolicy.ascx.resx | 3 + .../ExchangeMailboxPlans.ascx.resx | 3 + .../ExchangeAddMailboxPlan.ascx.cs | 7 +- .../ExchangeServer/ExchangeCreateMailbox.ascx | 8 +- .../ExchangeCreateMailbox.ascx.cs | 4 +- .../ExchangeCreateMailbox.ascx.designer.cs | 55 ++-- .../ExchangeMailboxGeneralSettings.ascx.cs | 5 +- .../ExchangeMailboxPlans.ascx.cs | 3 +- .../ExchangeRetentionPolicyTag.ascx | 7 +- .../ExchangeRetentionPolicyTag.ascx.cs | 66 ++-- ...xchangeRetentionPolicyTag.ascx.designer.cs | 9 + .../ExchangeServer/UserControls/Menu.ascx.cs | 8 +- ...SettingsExchangeMailboxPlansPolicy.ascx.cs | 37 ++- .../SettingsExchangeRetentionPolicyTag.ascx | 2 +- ...SettingsExchangeRetentionPolicyTag.ascx.cs | 30 +- 25 files changed, 702 insertions(+), 304 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs index adc16ef7..c02a5ab9 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs @@ -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 diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs index 8f48a15d..dd7f085b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs @@ -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; + + //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -1048,11 +1052,11 @@ namespace WebsitePanel.EnterpriseServer { /// [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])); } /// @@ -1063,9 +1067,9 @@ namespace WebsitePanel.EnterpriseServer { } /// - 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])); } /// @@ -1092,11 +1096,11 @@ namespace WebsitePanel.EnterpriseServer { /// [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])); } /// @@ -1107,9 +1111,9 @@ namespace WebsitePanel.EnterpriseServer { } /// - 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])); } /// @@ -1136,11 +1140,11 @@ namespace WebsitePanel.EnterpriseServer { /// [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])); } /// @@ -1151,9 +1155,9 @@ namespace WebsitePanel.EnterpriseServer { } /// - 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])); } /// @@ -1223,11 +1227,11 @@ namespace WebsitePanel.EnterpriseServer { /// [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])); } /// @@ -1238,9 +1242,9 @@ namespace WebsitePanel.EnterpriseServer { } /// - 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])); } /// @@ -1268,12 +1272,12 @@ namespace WebsitePanel.EnterpriseServer { /// [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])); } /// @@ -1285,9 +1289,9 @@ namespace WebsitePanel.EnterpriseServer { } /// - 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])); } /// @@ -5808,10 +5812,10 @@ namespace WebsitePanel.EnterpriseServer { } /// - 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 { } /// - 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 { } /// - 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 { } /// - 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 { } /// - public int Result { + public ResultObject Result { get { this.RaiseExceptionIfNecessary(); - return ((int)(this.results[0])); + return ((ResultObject)(this.results[0])); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs index e528cd46..9ecbc2de 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs @@ -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 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 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("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("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("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("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("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; } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs index a8ac2267..cd7990be 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs @@ -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); } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IExchangeServer.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IExchangeServer.cs index 805b4d9b..e1158fc6 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IExchangeServer.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/IExchangeServer.cs @@ -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); } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs index 32206f15..c0a1ae5e 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs @@ -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 ExecuteShellCommand(Runspace runSpace, Command cmd, ResultObject res) + { + return ExecuteShellCommand(runSpace, cmd, res, true); + } + + internal Collection ExecuteShellCommand(Runspace runSpace, Command cmd, ResultObject res, bool setIsSuccess) + { + object[] errors; + Collection 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 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 result = ExecuteShellCommand(runSpace, cmd); + Collection 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 result = ExecuteShellCommand(runSpace, cmd); + Collection 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; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs index c63a42cb..b5ba8e27 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Exchange2007.cs @@ -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; } diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/ExchangeServerProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/ExchangeServerProxy.cs index f9c50bf0..b7a60079 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/ExchangeServerProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/ExchangeServerProxy.cs @@ -27,6 +27,7 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.Common; //------------------------------------------------------------------------------ // @@ -853,15 +854,16 @@ namespace WebsitePanel.Providers.Exchange /// [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])); } /// @@ -877,9 +879,10 @@ namespace WebsitePanel.Providers.Exchange } /// - public void EndSetMailBoxArchiving(System.IAsyncResult asyncResult) + public ResultObject EndSetMailBoxArchiving(System.IAsyncResult asyncResult) { - this.EndInvoke(asyncResult); + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); } /// @@ -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)); } } /// [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])); } /// @@ -936,9 +940,10 @@ namespace WebsitePanel.Providers.Exchange } /// - public void EndSetRetentionPolicyTag(System.IAsyncResult asyncResult) + public ResultObject EndSetRetentionPolicyTag(System.IAsyncResult asyncResult) { - this.EndInvoke(asyncResult); + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); } /// @@ -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)); } } /// [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])); } /// @@ -987,9 +993,10 @@ namespace WebsitePanel.Providers.Exchange } /// - public void EndRemoveRetentionPolicyTag(System.IAsyncResult asyncResult) + public ResultObject EndRemoveRetentionPolicyTag(System.IAsyncResult asyncResult) { - this.EndInvoke(asyncResult); + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); } /// @@ -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)); } } /// [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])); } /// @@ -1037,9 +1045,10 @@ namespace WebsitePanel.Providers.Exchange } /// - public void EndSetRetentionPolicy(System.IAsyncResult asyncResult) + public ResultObject EndSetRetentionPolicy(System.IAsyncResult asyncResult) { - this.EndInvoke(asyncResult); + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); } /// @@ -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)); } } /// [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])); } /// @@ -1086,9 +1096,10 @@ namespace WebsitePanel.Providers.Exchange } /// - public void EndRemoveRetentionPolicy(System.IAsyncResult asyncResult) + public ResultObject EndRemoveRetentionPolicy(System.IAsyncResult asyncResult) { - this.EndInvoke(asyncResult); + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); } /// @@ -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 /// [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); /// [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; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } /// [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); /// [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; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } /// [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); + + /// + [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; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void SetRetentionPolicyCompletedEventHandler(object sender, SetRetentionPolicyCompletedEventArgs e); + + /// + [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; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void RemoveRetentionPolicyCompletedEventHandler(object sender, RemoveRetentionPolicyCompletedEventArgs e); + + /// + [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; + } + + /// + public ResultObject Result + { + get + { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] diff --git a/WebsitePanel/Sources/WebsitePanel.Server/ExchangeServer.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/ExchangeServer.asmx.cs index d6e30cfe..a58430a5 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/ExchangeServer.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/ExchangeServer.asmx.cs @@ -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 diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index fe8a1b6f..831d1f11 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5437,4 +5437,16 @@ Archiving storage, MB + + Unable to delete Retention policy. + + + Retention policy update failed + + + Retention policy deleted. + + + Retention policy updated + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangeMailboxPlansPolicy.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangeMailboxPlansPolicy.ascx.resx index fa042915..220a268c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangeMailboxPlansPolicy.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangeMailboxPlansPolicy.ascx.resx @@ -246,4 +246,7 @@ Litigation Hold Url: + + Retention policy + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeMailboxPlans.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeMailboxPlans.ascx.resx index 852a5164..30cb11b8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeMailboxPlans.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeMailboxPlans.ascx.resx @@ -165,4 +165,7 @@ Retention Policy + + Retention policy + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx.cs index 39e9b7e6..a972defa 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx.cs @@ -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; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx index 00b12198..53cefe52 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx @@ -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 @@
+
+ +
+
@@ -139,7 +145,7 @@ - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs index 0b49a1aa..c4a55052 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs @@ -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); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.designer.cs index 3f01dc0e..9a674982 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.designer.cs @@ -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. - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -58,6 +30,24 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl divWrapper; + /// + /// breadcrumb control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb; + + /// + /// menu control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; + /// /// Image1 control. /// @@ -337,6 +327,15 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelector; + /// + /// rowRetentionPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow rowRetentionPolicy; + /// /// locRetentionPolicyName control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs index 4a44d16e..ea07d7a3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs @@ -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); + } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.cs index 786e7e4c..5f94eb6f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxPlans.ascx.cs @@ -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; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx index 24819f20..2f17136e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx @@ -92,7 +92,7 @@ - +
+ +
+ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx.cs index a7aa6b11..f408cb91 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx.cs @@ -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(); + } + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx.designer.cs index 5115c0b3..d062e890 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx.designer.cs @@ -192,6 +192,15 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::System.Web.UI.WebControls.Button btnUpdatePolicy; + /// + /// btnCancelPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancelPolicy; + /// /// txtStatus control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs index eb294a8c..f37953ab 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs @@ -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) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.cs index 77d79e9d..7bee29dc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.cs @@ -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 tags = ViewState["Tags"] as List; 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; + } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx index 03bee3b4..988cdb78 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx @@ -65,7 +65,7 @@ - +
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 {