diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs index 61f01a5c..9ffbd13b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/ExchangeServerProxy.cs @@ -44,7 +44,8 @@ using WebsitePanel.Providers.ResultObjects; // // This source code was auto-generated by wsdl, Version=2.0.50727.42. // -namespace WebsitePanel.EnterpriseServer { +namespace WebsitePanel.EnterpriseServer +{ using System.Xml.Serialization; using System.Web.Services; using System.ComponentModel; @@ -81,6 +82,22 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback SetOrganizationDefaultExchangeMailboxPlanOperationCompleted; + private System.Threading.SendOrPostCallback GetExchangeRetentionPolicyTagsOperationCompleted; + + private System.Threading.SendOrPostCallback GetExchangeRetentionPolicyTagOperationCompleted; + + private System.Threading.SendOrPostCallback AddExchangeRetentionPolicyTagOperationCompleted; + + private System.Threading.SendOrPostCallback UpdateExchangeRetentionPolicyTagOperationCompleted; + + private System.Threading.SendOrPostCallback DeleteExchangeRetentionPolicyTagOperationCompleted; + + private System.Threading.SendOrPostCallback GetExchangeMailboxPlanRetentionPolicyTagsOperationCompleted; + + private System.Threading.SendOrPostCallback AddExchangeMailboxPlanRetentionPolicyTagOperationCompleted; + + private System.Threading.SendOrPostCallback DeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted; + private System.Threading.SendOrPostCallback CreatePublicFolderOperationCompleted; private System.Threading.SendOrPostCallback DeletePublicFoldersOperationCompleted; @@ -281,6 +298,30 @@ namespace WebsitePanel.EnterpriseServer { /// public event SetOrganizationDefaultExchangeMailboxPlanCompletedEventHandler SetOrganizationDefaultExchangeMailboxPlanCompleted; + /// + public event GetExchangeRetentionPolicyTagsCompletedEventHandler GetExchangeRetentionPolicyTagsCompleted; + + /// + public event GetExchangeRetentionPolicyTagCompletedEventHandler GetExchangeRetentionPolicyTagCompleted; + + /// + public event AddExchangeRetentionPolicyTagCompletedEventHandler AddExchangeRetentionPolicyTagCompleted; + + /// + public event UpdateExchangeRetentionPolicyTagCompletedEventHandler UpdateExchangeRetentionPolicyTagCompleted; + + /// + public event DeleteExchangeRetentionPolicyTagCompletedEventHandler DeleteExchangeRetentionPolicyTagCompleted; + + /// + public event GetExchangeMailboxPlanRetentionPolicyTagsCompletedEventHandler GetExchangeMailboxPlanRetentionPolicyTagsCompleted; + + /// + public event AddExchangeMailboxPlanRetentionPolicyTagCompletedEventHandler AddExchangeMailboxPlanRetentionPolicyTagCompleted; + + /// + public event DeleteExchangeMailboxPlanRetentionPolicyTagCompletedEventHandler DeleteExchangeMailboxPlanRetentionPolicyTagCompleted; + /// public event CreatePublicFolderCompletedEventHandler CreatePublicFolderCompleted; @@ -922,6 +963,355 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetExchangeRetentionPolicyTags", 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 ExchangeRetentionPolicyTag[] GetExchangeRetentionPolicyTags(int itemId) { + object[] results = this.Invoke("GetExchangeRetentionPolicyTags", new object[] { + itemId}); + return ((ExchangeRetentionPolicyTag[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetExchangeRetentionPolicyTags(int itemId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetExchangeRetentionPolicyTags", new object[] { + itemId}, callback, asyncState); + } + + /// + public ExchangeRetentionPolicyTag[] EndGetExchangeRetentionPolicyTags(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ExchangeRetentionPolicyTag[])(results[0])); + } + + /// + public void GetExchangeRetentionPolicyTagsAsync(int itemId) { + this.GetExchangeRetentionPolicyTagsAsync(itemId, null); + } + + /// + public void GetExchangeRetentionPolicyTagsAsync(int itemId, object userState) { + if ((this.GetExchangeRetentionPolicyTagsOperationCompleted == null)) { + this.GetExchangeRetentionPolicyTagsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetExchangeRetentionPolicyTagsOperationCompleted); + } + this.InvokeAsync("GetExchangeRetentionPolicyTags", new object[] { + itemId}, this.GetExchangeRetentionPolicyTagsOperationCompleted, userState); + } + + private void OnGetExchangeRetentionPolicyTagsOperationCompleted(object arg) { + if ((this.GetExchangeRetentionPolicyTagsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetExchangeRetentionPolicyTagsCompleted(this, new GetExchangeRetentionPolicyTagsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetExchangeRetentionPolicyTag", 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 ExchangeRetentionPolicyTag GetExchangeRetentionPolicyTag(int itemId, int tagId) { + object[] results = this.Invoke("GetExchangeRetentionPolicyTag", new object[] { + itemId, + tagId}); + return ((ExchangeRetentionPolicyTag)(results[0])); + } + + /// + public System.IAsyncResult BeginGetExchangeRetentionPolicyTag(int itemId, int tagId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetExchangeRetentionPolicyTag", new object[] { + itemId, + tagId}, callback, asyncState); + } + + /// + public ExchangeRetentionPolicyTag EndGetExchangeRetentionPolicyTag(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ExchangeRetentionPolicyTag)(results[0])); + } + + /// + public void GetExchangeRetentionPolicyTagAsync(int itemId, int tagId) { + this.GetExchangeRetentionPolicyTagAsync(itemId, tagId, null); + } + + /// + public void GetExchangeRetentionPolicyTagAsync(int itemId, int tagId, object userState) { + if ((this.GetExchangeRetentionPolicyTagOperationCompleted == null)) { + this.GetExchangeRetentionPolicyTagOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetExchangeRetentionPolicyTagOperationCompleted); + } + this.InvokeAsync("GetExchangeRetentionPolicyTag", new object[] { + itemId, + tagId}, this.GetExchangeRetentionPolicyTagOperationCompleted, userState); + } + + private void OnGetExchangeRetentionPolicyTagOperationCompleted(object arg) { + if ((this.GetExchangeRetentionPolicyTagCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetExchangeRetentionPolicyTagCompleted(this, new GetExchangeRetentionPolicyTagCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [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) { + object[] results = this.Invoke("AddExchangeRetentionPolicyTag", new object[] { + itemId, + tag}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginAddExchangeRetentionPolicyTag(int itemId, ExchangeRetentionPolicyTag tag, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("AddExchangeRetentionPolicyTag", new object[] { + itemId, + tag}, callback, asyncState); + } + + /// + public int EndAddExchangeRetentionPolicyTag(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void AddExchangeRetentionPolicyTagAsync(int itemId, ExchangeRetentionPolicyTag tag) { + this.AddExchangeRetentionPolicyTagAsync(itemId, tag, null); + } + + /// + public void AddExchangeRetentionPolicyTagAsync(int itemId, ExchangeRetentionPolicyTag tag, object userState) { + if ((this.AddExchangeRetentionPolicyTagOperationCompleted == null)) { + this.AddExchangeRetentionPolicyTagOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddExchangeRetentionPolicyTagOperationCompleted); + } + this.InvokeAsync("AddExchangeRetentionPolicyTag", new object[] { + itemId, + tag}, this.AddExchangeRetentionPolicyTagOperationCompleted, userState); + } + + private void OnAddExchangeRetentionPolicyTagOperationCompleted(object arg) { + if ((this.AddExchangeRetentionPolicyTagCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddExchangeRetentionPolicyTagCompleted(this, new AddExchangeRetentionPolicyTagCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [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) { + object[] results = this.Invoke("UpdateExchangeRetentionPolicyTag", new object[] { + itemId, + tag}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginUpdateExchangeRetentionPolicyTag(int itemId, ExchangeRetentionPolicyTag tag, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("UpdateExchangeRetentionPolicyTag", new object[] { + itemId, + tag}, callback, asyncState); + } + + /// + public int EndUpdateExchangeRetentionPolicyTag(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void UpdateExchangeRetentionPolicyTagAsync(int itemId, ExchangeRetentionPolicyTag tag) { + this.UpdateExchangeRetentionPolicyTagAsync(itemId, tag, null); + } + + /// + public void UpdateExchangeRetentionPolicyTagAsync(int itemId, ExchangeRetentionPolicyTag tag, object userState) { + if ((this.UpdateExchangeRetentionPolicyTagOperationCompleted == null)) { + this.UpdateExchangeRetentionPolicyTagOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateExchangeRetentionPolicyTagOperationCompleted); + } + this.InvokeAsync("UpdateExchangeRetentionPolicyTag", new object[] { + itemId, + tag}, this.UpdateExchangeRetentionPolicyTagOperationCompleted, userState); + } + + private void OnUpdateExchangeRetentionPolicyTagOperationCompleted(object arg) { + if ((this.UpdateExchangeRetentionPolicyTagCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.UpdateExchangeRetentionPolicyTagCompleted(this, new UpdateExchangeRetentionPolicyTagCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [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) { + object[] results = this.Invoke("DeleteExchangeRetentionPolicyTag", new object[] { + itemId, + tagId}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginDeleteExchangeRetentionPolicyTag(int itemId, int tagId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("DeleteExchangeRetentionPolicyTag", new object[] { + itemId, + tagId}, callback, asyncState); + } + + /// + public int EndDeleteExchangeRetentionPolicyTag(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void DeleteExchangeRetentionPolicyTagAsync(int itemId, int tagId) { + this.DeleteExchangeRetentionPolicyTagAsync(itemId, tagId, null); + } + + /// + public void DeleteExchangeRetentionPolicyTagAsync(int itemId, int tagId, object userState) { + if ((this.DeleteExchangeRetentionPolicyTagOperationCompleted == null)) { + this.DeleteExchangeRetentionPolicyTagOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteExchangeRetentionPolicyTagOperationCompleted); + } + this.InvokeAsync("DeleteExchangeRetentionPolicyTag", new object[] { + itemId, + tagId}, this.DeleteExchangeRetentionPolicyTagOperationCompleted, userState); + } + + private void OnDeleteExchangeRetentionPolicyTagOperationCompleted(object arg) { + if ((this.DeleteExchangeRetentionPolicyTagCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.DeleteExchangeRetentionPolicyTagCompleted(this, new DeleteExchangeRetentionPolicyTagCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetExchangeMailboxPlanRetentionPolic" + + "yTags", 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 ExchangeMailboxPlanRetentionPolicyTag[] GetExchangeMailboxPlanRetentionPolicyTags(int policyId) { + object[] results = this.Invoke("GetExchangeMailboxPlanRetentionPolicyTags", new object[] { + policyId}); + return ((ExchangeMailboxPlanRetentionPolicyTag[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetExchangeMailboxPlanRetentionPolicyTags(int policyId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetExchangeMailboxPlanRetentionPolicyTags", new object[] { + policyId}, callback, asyncState); + } + + /// + public ExchangeMailboxPlanRetentionPolicyTag[] EndGetExchangeMailboxPlanRetentionPolicyTags(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ExchangeMailboxPlanRetentionPolicyTag[])(results[0])); + } + + /// + public void GetExchangeMailboxPlanRetentionPolicyTagsAsync(int policyId) { + this.GetExchangeMailboxPlanRetentionPolicyTagsAsync(policyId, null); + } + + /// + public void GetExchangeMailboxPlanRetentionPolicyTagsAsync(int policyId, object userState) { + if ((this.GetExchangeMailboxPlanRetentionPolicyTagsOperationCompleted == null)) { + this.GetExchangeMailboxPlanRetentionPolicyTagsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetExchangeMailboxPlanRetentionPolicyTagsOperationCompleted); + } + this.InvokeAsync("GetExchangeMailboxPlanRetentionPolicyTags", new object[] { + policyId}, this.GetExchangeMailboxPlanRetentionPolicyTagsOperationCompleted, userState); + } + + private void OnGetExchangeMailboxPlanRetentionPolicyTagsOperationCompleted(object arg) { + if ((this.GetExchangeMailboxPlanRetentionPolicyTagsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetExchangeMailboxPlanRetentionPolicyTagsCompleted(this, new GetExchangeMailboxPlanRetentionPolicyTagsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [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) { + object[] results = this.Invoke("AddExchangeMailboxPlanRetentionPolicyTag", new object[] { + itemId, + planTag}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginAddExchangeMailboxPlanRetentionPolicyTag(int itemId, ExchangeMailboxPlanRetentionPolicyTag planTag, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("AddExchangeMailboxPlanRetentionPolicyTag", new object[] { + itemId, + planTag}, callback, asyncState); + } + + /// + public int EndAddExchangeMailboxPlanRetentionPolicyTag(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void AddExchangeMailboxPlanRetentionPolicyTagAsync(int itemId, ExchangeMailboxPlanRetentionPolicyTag planTag) { + this.AddExchangeMailboxPlanRetentionPolicyTagAsync(itemId, planTag, null); + } + + /// + public void AddExchangeMailboxPlanRetentionPolicyTagAsync(int itemId, ExchangeMailboxPlanRetentionPolicyTag planTag, object userState) { + if ((this.AddExchangeMailboxPlanRetentionPolicyTagOperationCompleted == null)) { + this.AddExchangeMailboxPlanRetentionPolicyTagOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddExchangeMailboxPlanRetentionPolicyTagOperationCompleted); + } + this.InvokeAsync("AddExchangeMailboxPlanRetentionPolicyTag", new object[] { + itemId, + planTag}, this.AddExchangeMailboxPlanRetentionPolicyTagOperationCompleted, userState); + } + + private void OnAddExchangeMailboxPlanRetentionPolicyTagOperationCompleted(object arg) { + if ((this.AddExchangeMailboxPlanRetentionPolicyTagCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddExchangeMailboxPlanRetentionPolicyTagCompleted(this, new AddExchangeMailboxPlanRetentionPolicyTagCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [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 planTagId) { + object[] results = this.Invoke("DeleteExchangeMailboxPlanRetentionPolicyTag", new object[] { + itemId, + planTagId}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginDeleteExchangeMailboxPlanRetentionPolicyTag(int itemId, int planTagId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("DeleteExchangeMailboxPlanRetentionPolicyTag", new object[] { + itemId, + planTagId}, callback, asyncState); + } + + /// + public int EndDeleteExchangeMailboxPlanRetentionPolicyTag(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void DeleteExchangeMailboxPlanRetentionPolicyTagAsync(int itemId, int planTagId) { + this.DeleteExchangeMailboxPlanRetentionPolicyTagAsync(itemId, planTagId, null); + } + + /// + public void DeleteExchangeMailboxPlanRetentionPolicyTagAsync(int itemId, int planTagId, object userState) { + if ((this.DeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted == null)) { + this.DeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted); + } + this.InvokeAsync("DeleteExchangeMailboxPlanRetentionPolicyTag", new object[] { + itemId, + planTagId}, this.DeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted, userState); + } + + private void OnDeleteExchangeMailboxPlanRetentionPolicyTagOperationCompleted(object arg) { + if ((this.DeleteExchangeMailboxPlanRetentionPolicyTagCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.DeleteExchangeMailboxPlanRetentionPolicyTagCompleted(this, new DeleteExchangeMailboxPlanRetentionPolicyTagCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/CreatePublicFolder", 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 CreatePublicFolder(int itemId, string parentFolder, string folderName, bool mailEnabled, string accountName, string domain) { @@ -5347,6 +5737,214 @@ namespace WebsitePanel.EnterpriseServer { [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] public delegate void SetOrganizationDefaultExchangeMailboxPlanCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void GetExchangeRetentionPolicyTagsCompletedEventHandler(object sender, GetExchangeRetentionPolicyTagsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetExchangeRetentionPolicyTagsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetExchangeRetentionPolicyTagsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ExchangeRetentionPolicyTag[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ExchangeRetentionPolicyTag[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void GetExchangeRetentionPolicyTagCompletedEventHandler(object sender, GetExchangeRetentionPolicyTagCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetExchangeRetentionPolicyTagCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetExchangeRetentionPolicyTagCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ExchangeRetentionPolicyTag Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ExchangeRetentionPolicyTag)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void AddExchangeRetentionPolicyTagCompletedEventHandler(object sender, AddExchangeRetentionPolicyTagCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddExchangeRetentionPolicyTagCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AddExchangeRetentionPolicyTagCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void UpdateExchangeRetentionPolicyTagCompletedEventHandler(object sender, UpdateExchangeRetentionPolicyTagCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class UpdateExchangeRetentionPolicyTagCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal UpdateExchangeRetentionPolicyTagCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void DeleteExchangeRetentionPolicyTagCompletedEventHandler(object sender, DeleteExchangeRetentionPolicyTagCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class DeleteExchangeRetentionPolicyTagCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal DeleteExchangeRetentionPolicyTagCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void GetExchangeMailboxPlanRetentionPolicyTagsCompletedEventHandler(object sender, GetExchangeMailboxPlanRetentionPolicyTagsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetExchangeMailboxPlanRetentionPolicyTagsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetExchangeMailboxPlanRetentionPolicyTagsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ExchangeMailboxPlanRetentionPolicyTag[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ExchangeMailboxPlanRetentionPolicyTag[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void AddExchangeMailboxPlanRetentionPolicyTagCompletedEventHandler(object sender, AddExchangeMailboxPlanRetentionPolicyTagCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddExchangeMailboxPlanRetentionPolicyTagCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AddExchangeMailboxPlanRetentionPolicyTagCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void DeleteExchangeMailboxPlanRetentionPolicyTagCompletedEventHandler(object sender, DeleteExchangeMailboxPlanRetentionPolicyTagCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class DeleteExchangeMailboxPlanRetentionPolicyTagCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal DeleteExchangeMailboxPlanRetentionPolicyTagCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] public delegate void CreatePublicFolderCompletedEventHandler(object sender, CreatePublicFolderCompletedEventArgs e); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs index f2e3b43e..c5c93191 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs @@ -2830,7 +2830,8 @@ namespace WebsitePanel.EnterpriseServer public static void UpdateExchangeMailboxPlan(int mailboxPlanID, string mailboxPlan, bool enableActiveSync, bool enableIMAP, bool enableMAPI, bool enableOWA, bool enablePOP, bool isDefault, int issueWarningPct, int keepDeletedItemsDays, int mailboxSizeMB, int maxReceiveMessageSizeKB, int maxRecipients, int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType, - bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg) + bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg, + bool Archiving, bool EnableArchiving) { SqlHelper.ExecuteNonQuery( ConnectionString, @@ -2858,7 +2859,9 @@ namespace WebsitePanel.EnterpriseServer new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning), new SqlParameter("@RecoverableItemsSpace", recoverabelItemsSpace), new SqlParameter("@LitigationHoldUrl", litigationHoldUrl), - new SqlParameter("@LitigationHoldMsg", litigationHoldMsg) + new SqlParameter("@LitigationHoldMsg", litigationHoldMsg), + new SqlParameter("@Archiving", Archiving), + new SqlParameter("@EnableArchiving", EnableArchiving) ); } @@ -2932,6 +2935,112 @@ namespace WebsitePanel.EnterpriseServer ); } + #endregion + + #region Exchange Retention Policy Tags + public static int AddExchangeRetentionPolicyTag(int ItemID, string TagName, int TagType, int AgeLimitForRetention, int RetentionAction) + { + SqlParameter outParam = new SqlParameter("@TagID", SqlDbType.Int); + outParam.Direction = ParameterDirection.Output; + + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "AddExchangeRetentionPolicyTag", + outParam, + new SqlParameter("@ItemID", ItemID), + new SqlParameter("@TagName", TagName), + new SqlParameter("@TagType", TagType), + new SqlParameter("@AgeLimitForRetention", AgeLimitForRetention), + new SqlParameter("@RetentionAction", RetentionAction) + ); + + return Convert.ToInt32(outParam.Value); + } + + public static void UpdateExchangeRetentionPolicyTag(int TagID, int ItemID, string TagName, int TagType, int AgeLimitForRetention, int RetentionAction) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "UpdateExchangeRetentionPolicyTag", + new SqlParameter("@TagID", TagID), + new SqlParameter("@ItemID", ItemID), + new SqlParameter("@TagName", TagName), + new SqlParameter("@TagType", TagType), + new SqlParameter("@AgeLimitForRetention", AgeLimitForRetention), + new SqlParameter("@RetentionAction", RetentionAction) + ); + } + + public static void DeleteExchangeRetentionPolicyTag(int TagID) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "DeleteExchangeRetentionPolicyTag", + new SqlParameter("@TagID", TagID) + ); + } + + public static IDataReader GetExchangeRetentionPolicyTag(int TagID) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetExchangeRetentionPolicyTag", + new SqlParameter("@TagID", TagID) + ); + } + + public static IDataReader GetExchangeRetentionPolicyTags(int itemId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetExchangeRetentionPolicyTags", + new SqlParameter("@ItemID", itemId) + ); + } + + public static int AddExchangeMailboxPlanRetentionPolicyTag(int TagID, int MailboxPlanId) + { + SqlParameter outParam = new SqlParameter("@PlanTagID", SqlDbType.Int); + outParam.Direction = ParameterDirection.Output; + + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "AddExchangeMailboxPlanRetentionPolicyTag", + outParam, + new SqlParameter("@TagID", TagID), + new SqlParameter("@MailboxPlanId", MailboxPlanId) + ); + + return Convert.ToInt32(outParam.Value); + } + + public static void DeleteExchangeMailboxPlanRetentionPolicyTag(int PlanTagID) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "DeleteExchangeMailboxPlanRetentionPolicyTag", + new SqlParameter("@PlanTagID", PlanTagID) + ); + } + + public static IDataReader GetExchangeMailboxPlanRetentionPolicyTags(int MailboxPlanId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetExchangeMailboxPlanRetentionPolicyTags", + new SqlParameter("@MailboxPlanId", MailboxPlanId) + ); + } + + #endregion #region Exchange Disclaimers diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs index 0ef790b1..83141117 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs @@ -2951,7 +2951,8 @@ namespace WebsitePanel.EnterpriseServer mailboxPlan.IsDefault, mailboxPlan.IssueWarningPct, mailboxPlan.KeepDeletedItemsDays, mailboxPlan.MailboxSizeMB, mailboxPlan.MaxReceiveMessageSizeKB, mailboxPlan.MaxRecipients, mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook, mailboxPlan.MailboxPlanType, mailboxPlan.AllowLitigationHold, mailboxPlan.RecoverableItemsSpace, mailboxPlan.RecoverableItemsWarningPct, - mailboxPlan.LitigationHoldUrl, mailboxPlan.LitigationHoldMsg); + mailboxPlan.LitigationHoldUrl, mailboxPlan.LitigationHoldMsg, + mailboxPlan.Archiving, mailboxPlan.EnableArchiving); } catch (Exception ex) { @@ -3012,6 +3013,262 @@ namespace WebsitePanel.EnterpriseServer #endregion + #region Exchange Retention Policy Tags + + public static List GetExchangeRetentionPolicyTags(int itemId) + { + // place log record + TaskManager.StartTask("EXCHANGE", "GET_EXCHANGE_RETENTIONPOLICYTAGS", itemId); + + try + { + List retentionPolicyTags = new List(); + + UserInfo user = ObjectUtils.FillObjectFromDataReader(DataProvider.GetUserByExchangeOrganizationIdInternally(itemId)); + + if (user.Role == UserRole.User) + ExchangeServerController.GetExchangeRetentionPolicyTagsByUser(itemId, user, ref retentionPolicyTags); + else + ExchangeServerController.GetExchangeRetentionPolicyTagsByUser(0, user, ref retentionPolicyTags); + + return retentionPolicyTags; + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + } + + private static void GetExchangeRetentionPolicyTagsByUser(int itemId, UserInfo user, ref List retentionPolicyTags) + { + if ((user != null)) + { + List orgs = null; + + if (user.UserId != 1) + { + List Packages = PackageController.GetPackages(user.UserId); + + if ((Packages != null) & (Packages.Count > 0)) + { + orgs = GetExchangeOrganizationsInternal(Packages[0].PackageId, false); + } + } + else + { + orgs = GetExchangeOrganizationsInternal(1, false); + } + + int OrgId = -1; + if (itemId > 0) OrgId = itemId; + else if ((orgs != null) & (orgs.Count > 0)) OrgId = orgs[0].Id; + + + if (OrgId != -1) + { + List RetentionPolicy = ObjectUtils.CreateListFromDataReader(DataProvider.GetExchangeRetentionPolicyTags(OrgId)); + + foreach (ExchangeRetentionPolicyTag p in RetentionPolicy) + { + retentionPolicyTags.Add(p); + } + } + + UserInfo owner = UserController.GetUserInternally(user.OwnerId); + + GetExchangeRetentionPolicyTagsByUser(0, owner, ref retentionPolicyTags); + } + } + + public static ExchangeRetentionPolicyTag GetExchangeRetentionPolicyTag(int itemID, int tagId) + { + + // place log record + TaskManager.StartTask("EXCHANGE", "GET_EXCHANGE_RETENTIONPOLICYTAG", tagId); + + try + { + return ObjectUtils.FillObjectFromDataReader( + DataProvider.GetExchangeRetentionPolicyTag(tagId)); + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + } + + public static int AddExchangeRetentionPolicyTag(int itemID, ExchangeRetentionPolicyTag tag) + { + // place log record + TaskManager.StartTask("EXCHANGE", "ADD_EXCHANGE_RETENTIONPOLICYTAG", itemID); + + try + { + Organization org = GetOrganization(itemID); + if (org == null) + return -1; + + // load package context + PackageContext cntx = PackageController.GetPackageContext(org.PackageId); + + if (org.PackageId > 1) + { + // quotas + } + + return DataProvider.AddExchangeRetentionPolicyTag(itemID, tag.TagName, tag.TagType, tag.AgeLimitForRetention, tag.RetentionAction ); + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + + } + + public static int UpdateExchangeRetentionPolicyTag(int itemID, ExchangeRetentionPolicyTag tag) + { + // place log record + TaskManager.StartTask("EXCHANGE", "UPDATE_EXCHANGE_RETENTIONPOLICYTAG", itemID); + + try + { + Organization org = GetOrganization(itemID); + if (org == null) + return -1; + + // load package context + PackageContext cntx = PackageController.GetPackageContext(org.PackageId); + + if (org.PackageId > 1) + { + // quotas + } + + DataProvider.UpdateExchangeRetentionPolicyTag(tag.TagID, tag.ItemID, tag.TagName, tag.TagType, tag.AgeLimitForRetention, tag.RetentionAction); + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + + + return 0; + } + + public static int DeleteExchangeRetentionPolicyTag(int itemID, int tagId) + { + TaskManager.StartTask("EXCHANGE", "DELETE_EXCHANGE_RETENTIONPOLICYTAG", itemID); + + try + { + DataProvider.DeleteExchangeRetentionPolicyTag(tagId); + + return 0; + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + + } + + + public static List GetExchangeMailboxPlanRetentionPolicyTags(int policyId) + { + // place log record + TaskManager.StartTask("EXCHANGE", "GET_EXCHANGE_RETENTIONPOLICYTAGS", policyId); + + try + { + List tags = + ObjectUtils.CreateListFromDataReader(DataProvider.GetExchangeMailboxPlanRetentionPolicyTags(policyId)); + + return tags; + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + } + + public static int AddExchangeMailboxPlanRetentionPolicyTag(int itemID, ExchangeMailboxPlanRetentionPolicyTag planTag) + { + // place log record + TaskManager.StartTask("EXCHANGE", "ADD_EXCHANGE_RETENTIONPOLICYTAG", itemID); + + try + { + Organization org = GetOrganization(itemID); + if (org == null) + return -1; + + // load package context + PackageContext cntx = PackageController.GetPackageContext(org.PackageId); + + if (org.PackageId > 1) + { + // quotas + } + + return DataProvider.AddExchangeMailboxPlanRetentionPolicyTag(planTag.TagID, planTag.MailboxPlanId); + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + + } + + public static int DeleteExchangeMailboxPlanRetentionPolicyTag(int itemID, int planTagId) + { + TaskManager.StartTask("EXCHANGE", "DELETE_EXCHANGE_RETENTIONPOLICYTAG", itemID); + + try + { + DataProvider.DeleteExchangeMailboxPlanRetentionPolicyTag(planTagId); + + return 0; + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + + } + + #endregion #region Contacts public static int CreateContact(int itemId, string displayName, string email) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs index 8d86fd5b..129400c4 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esExchangeServer.asmx.cs @@ -549,8 +549,7 @@ namespace WebsitePanel.EnterpriseServer { return ExchangeServerController.UpdateExchangeMailboxPlan(itemId, mailboxPlan); } - - + [WebMethod] public int DeleteExchangeMailboxPlan(int itemId, int mailboxPlanId) { @@ -565,6 +564,59 @@ namespace WebsitePanel.EnterpriseServer #endregion + #region Exchange Retention Policy Tags + + [WebMethod] + public List GetExchangeRetentionPolicyTags(int itemId) + { + return ExchangeServerController.GetExchangeRetentionPolicyTags(itemId); + } + + [WebMethod] + public ExchangeRetentionPolicyTag GetExchangeRetentionPolicyTag(int itemId, int tagId) + { + return ExchangeServerController.GetExchangeRetentionPolicyTag(itemId, tagId); + } + + [WebMethod] + public int AddExchangeRetentionPolicyTag(int itemId, ExchangeRetentionPolicyTag tag) + { + return ExchangeServerController.AddExchangeRetentionPolicyTag(itemId, tag); + } + + [WebMethod] + public int UpdateExchangeRetentionPolicyTag(int itemId, ExchangeRetentionPolicyTag tag) + { + return ExchangeServerController.UpdateExchangeRetentionPolicyTag(itemId, tag); + } + + [WebMethod] + public int DeleteExchangeRetentionPolicyTag(int itemId, int tagId) + { + return ExchangeServerController.DeleteExchangeRetentionPolicyTag(itemId, tagId); + } + + + [WebMethod] + public List GetExchangeMailboxPlanRetentionPolicyTags(int policyId) + { + return ExchangeServerController.GetExchangeMailboxPlanRetentionPolicyTags(policyId); + } + + [WebMethod] + public int AddExchangeMailboxPlanRetentionPolicyTag(int itemId, ExchangeMailboxPlanRetentionPolicyTag planTag) + { + return ExchangeServerController.AddExchangeMailboxPlanRetentionPolicyTag(itemId, planTag); + } + + [WebMethod] + public int DeleteExchangeMailboxPlanRetentionPolicyTag(int itemId, int planTagId) + { + return ExchangeServerController.DeleteExchangeMailboxPlanRetentionPolicyTag(itemId, planTagId); + } + + #endregion + #region Public Folders [WebMethod] diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeMailboxPlanRetentionPolicyTag.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeMailboxPlanRetentionPolicyTag.cs new file mode 100644 index 00000000..2ed651d5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeMailboxPlanRetentionPolicyTag.cs @@ -0,0 +1,76 @@ +// 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. + +using System; +using System.Collections.Generic; +using System.Text; + + +namespace WebsitePanel.Providers.HostedSolution +{ + [Serializable] + public class ExchangeMailboxPlanRetentionPolicyTag + { + int planTagID; + public int PlanTagID + { + get { return planTagID; } + set { planTagID = value; } + } + + int tagID; + public int TagID + { + get { return tagID; } + set { tagID = value; } + } + + int mailboxPlanId; + public int MailboxPlanId + { + get { return mailboxPlanId; } + set { mailboxPlanId = value; } + } + + string mailboxPlan; + public string MailboxPlan + { + get { return mailboxPlan; } + set { mailboxPlan = value; } + } + + string tagName; + public string TagName + { + get { return tagName; } + set { tagName = value; } + } + + + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeRetentionPolicyTag.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeRetentionPolicyTag.cs new file mode 100644 index 00000000..a9b6ba1c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeRetentionPolicyTag.cs @@ -0,0 +1,80 @@ +// 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. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebsitePanel.Providers.HostedSolution +{ + public class ExchangeRetentionPolicyTag + { + int tagID; + public int TagID + { + get { return tagID; } + set { tagID = value; } + } + + int itemID; + public int ItemID + { + get { return itemID; } + set { itemID = value; } + } + + string tagName; + public string TagName + { + get { return tagName; } + set { tagName = value; } + } + + int tagType; + public int TagType + { + get { return tagType; } + set { tagType = value; } + } + + int ageLimitForRetention; + public int AgeLimitForRetention + { + get { return ageLimitForRetention; } + set { ageLimitForRetention = value;} + } + + int retentionAction; + public int RetentionAction + { + get { return retentionAction; } + set { retentionAction = value; } + } + + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeRetentionPolicyTagAction.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeRetentionPolicyTagAction.cs new file mode 100644 index 00000000..89e26d7e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeRetentionPolicyTagAction.cs @@ -0,0 +1,41 @@ +// 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. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebsitePanel.Providers.HostedSolution +{ + public enum ExchangeRetentionPolicyTagAction + { + MoveToDeletedItems, + MoveToFolder, + DeleteAndAllowRecovery, + PermanentlyDelete, + MarkAsPastRetentionLimit, + MoveToArchive + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeRetentionPolicyTagType.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeRetentionPolicyTagType.cs new file mode 100644 index 00000000..66c68cba --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeRetentionPolicyTagType.cs @@ -0,0 +1,58 @@ +// 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. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebsitePanel.Providers.HostedSolution +{ + public enum ExchangeRetentionPolicyTagType + { + Calendar, + Contacts, + DeletedItems, + Drafts, + Inbox, + JunkEmail, + Journal, + Notes, + Outbox, + SentItems, + Tasks, + All, + ManagedCustomFolder, + RssSubscriptions, + SyncIssues, + ConversationHistory, + Personal, + RecoverableItems, + NonIpmRoot, + LegacyArchiveJournals + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index 3e0c109c..6a3141a3 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -93,10 +93,14 @@ + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config index 379d1875..ecb4de84 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config @@ -514,6 +514,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangeRetentionPolicyTag.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangeRetentionPolicyTag.ascx.resx new file mode 100644 index 00000000..4b7a62be --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangeRetentionPolicyTag.ascx.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Retention policy + + + Select + + + No Retention policy tags have been added yet. To add a new mailbox plan click "Add New" button. + + + Select + + + Please enter correct retention policy tags + + + * + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeAddMailboxPlan.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeAddMailboxPlan.ascx.resx index d3e7ed41..51a4e3a7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeAddMailboxPlan.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeAddMailboxPlan.ascx.resx @@ -217,6 +217,6 @@ Litigation Hold Url: - Add Archiving Mailbox plan + Add Retention policy \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeRetentionPolicyTag.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeRetentionPolicyTag.ascx.resx new file mode 100644 index 00000000..862adf53 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeRetentionPolicyTag.ascx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Retention policy + + + Select + + + No Retention policy tags have been added yet. To add a new mailbox plan click "Add New" button. + + + Select + + + Please enter correct retention policy tags + + + * + + + Mailbox plans + + + Retention policy tags + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx index 0f201cb2..4747151b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx @@ -8,6 +8,8 @@ <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> <%@ Register Src="../UserControls/QuotaEditor.ascx" TagName="QuotaEditor" TagPrefix="uc1" %> +<%@ Import Namespace="WebsitePanel.Portal" %> +
@@ -226,6 +228,39 @@ + + + + + + + + + + + <%# PortalAntiXSS.Encode((string)Eval("TagName"))%> + + + + +   + + + + + +
+ + + +
+
+
+

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 b9a5e4ab..6b452dfc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2011, Outercurve Foundation. +// Copyright (c) 2011-2014, Outercurve Foundation. // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, @@ -27,6 +27,13 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Collections.Generic; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.ResultObjects; @@ -85,6 +92,14 @@ namespace WebsitePanel.Portal.ExchangeServer chkEnableArchiving.Checked = plan.EnableArchiving; locTitle.Text = plan.MailboxPlan; + + if (RetentionPolicy) + { + ExchangeMailboxPlanRetentionPolicyTag[] tags = ES.Services.ExchangeServer.GetExchangeMailboxPlanRetentionPolicyTags(plan.MailboxPlanId); + gvPolicy.DataSource = tags; + gvPolicy.DataBind(); + } + this.DisableControls = true; } @@ -162,13 +177,40 @@ namespace WebsitePanel.Portal.ExchangeServer locTitle.Text = RetentionPolicy ? GetLocalizedString("locTitleArchiving.Text") : GetLocalizedString("locTitle.Text"); + UpdateTags(); + secMailboxFeatures.Visible = !RetentionPolicy; secMailboxGeneral.Visible = !RetentionPolicy; + secRetentionPolicyTags.Visible = RetentionPolicy; + } } + protected void UpdateTags() + { + if (RetentionPolicy) + { + ddTags.Items.Clear(); + + Providers.HostedSolution.ExchangeRetentionPolicyTag[] allTags = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTags(PanelRequest.ItemID); + + List selectedTags = ViewState["Tags"] as List; + + foreach (Providers.HostedSolution.ExchangeRetentionPolicyTag tag in allTags) + { + if (selectedTags!=null) + { + if (selectedTags.Find(x => x.TagID == tag.TagID) != null) + continue; + } + + ddTags.Items.Add(new System.Web.UI.WebControls.ListItem(tag.TagName, tag.TagID.ToString())); + } + } + } + protected void btnAdd_Click(object sender, EventArgs e) { AddMailboxPlan(); @@ -211,16 +253,33 @@ namespace WebsitePanel.Portal.ExchangeServer plan.EnableArchiving = chkEnableArchiving.Checked; - int result = ES.Services.ExchangeServer.AddExchangeMailboxPlan(PanelRequest.ItemID, + int planId = ES.Services.ExchangeServer.AddExchangeMailboxPlan(PanelRequest.ItemID, plan); - if (result < 0) + if (planId < 0) { - messageBox.ShowResultMessage(result); + messageBox.ShowResultMessage(planId); return; } + List tags = ViewState["Tags"] as List; + + if (tags!=null) + { + foreach(ExchangeMailboxPlanRetentionPolicyTag tag in tags) + { + tag.MailboxPlanId = planId; + int result = ES.Services.ExchangeServer.AddExchangeMailboxPlanRetentionPolicyTag(PanelRequest.ItemID, tag); + if (result < 0) + { + messageBox.ShowResultMessage(result); + return; + } + } + } + + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), RetentionPolicy ? "retentionpolicy" : "mailboxplans", "SpaceID=" + PanelSecurity.PackageId)); } @@ -229,5 +288,65 @@ namespace WebsitePanel.Portal.ExchangeServer messageBox.ShowErrorMessage("EXCHANGE_ADD_MAILBOXPLAN", ex); } } + + protected void bntAddTag_Click(object sender, EventArgs e) + { + int addTagId; + if (!int.TryParse(ddTags.SelectedValue, out addTagId)) + return; + + Providers.HostedSolution.ExchangeRetentionPolicyTag tag = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTag(PanelRequest.ItemID, addTagId); + if (tag == null) return; + + List res = ViewState["Tags"] as List; + if (res==null) res = new List(); + + ExchangeMailboxPlanRetentionPolicyTag add = new ExchangeMailboxPlanRetentionPolicyTag(); + add.MailboxPlanId = PanelRequest.GetInt("MailboxPlanId"); + add.TagID = tag.TagID; + add.TagName = tag.TagName; + + res.Add(add); + + ViewState["Tags"] = res; + + gvPolicy.DataSource = res; + gvPolicy.DataBind(); + + UpdateTags(); + } + + protected void gvPolicy_RowCommand(object sender, GridViewCommandEventArgs e) + { + + switch (e.CommandName) + { + case "DeleteItem": + try + { + int tagId; + if (!int.TryParse(e.CommandArgument.ToString(), out tagId)) + return; + + List tags = ViewState["Tags"] as List; + if (tags == null) return; + + int i = tags.FindIndex(x => x.TagID == tagId); + if (i >= 0) tags.RemoveAt(i); + + ViewState["Tags"] = tags; + gvPolicy.DataSource = tags; + gvPolicy.DataBind(); + UpdateTags(); + } + catch (Exception) + { + } + + break; + + } + } + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx.designer.cs index 57d478fa..11d7b600 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddMailboxPlan.ascx.designer.cs @@ -498,6 +498,60 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::System.Web.UI.WebControls.TextBox txtLitigationHoldMsg; + /// + /// secRetentionPolicyTags control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secRetentionPolicyTags; + + /// + /// RetentionPolicyTags control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel RetentionPolicyTags; + + /// + /// GeneralUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel GeneralUpdatePanel; + + /// + /// gvPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvPolicy; + + /// + /// ddTags control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddTags; + + /// + /// bntAddTag control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button bntAddTag; + /// /// btnAdd control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx index 881987b9..b3278a57 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx @@ -10,7 +10,7 @@ <%@ Register Src="UserControls/MailboxPlanSelector.ascx" TagName="MailboxPlanSelector" TagPrefix="wsp" %> <%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %> - +<%-- < wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/> --%>
@@ -32,10 +32,11 @@ - - - - + + + + + @@ -54,7 +55,7 @@ @@ -71,14 +72,10 @@
- +
-
-
-
+ - - - - + + @@ -87,15 +84,16 @@ - +
- +
-
-
-
+ + + + 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 44a83cf7..8233dc9c 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) 2012, Outercurve Foundation. +// Copyright (c) 2012-2014, Outercurve Foundation. // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, @@ -34,13 +34,25 @@ namespace WebsitePanel.Portal.ExchangeServer { public partial class ExchangeMailboxGeneralSettings : WebsitePanelModuleBase { + + private PackageContext cntx = null; + private PackageContext Cntx + { + get + { + if (cntx == null) + cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + + return cntx; + } + } + protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { - PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); - if (Utils.CheckQouta(Quotas.EXCHANGE2007_DISCLAIMERSALLOWED, cntx)) + if (Utils.CheckQouta(Quotas.EXCHANGE2007_DISCLAIMERSALLOWED, Cntx)) { ddDisclaimer.Items.Add(new System.Web.UI.WebControls.ListItem("None", "-1")); ExchangeDisclaimer[] disclaimers = ES.Services.ExchangeServer.GetExchangeDisclaimers(PanelRequest.ItemID); @@ -53,34 +65,27 @@ namespace WebsitePanel.Portal.ExchangeServer ddDisclaimer.Visible = false; } - secArchiving.Visible = Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx); - BindSettings(); + SetArchivingVisible(); + UserInfo user = UsersHelper.GetUser(PanelSecurity.EffectiveUserId); if (user != null) { - if ((user.Role == UserRole.User) & (Utils.CheckQouta(Quotas.EXCHANGE2007_ISCONSUMER, cntx))) + if ((user.Role == UserRole.User) & (Utils.CheckQouta(Quotas.EXCHANGE2007_ISCONSUMER, Cntx))) { chkHideAddressBook.Visible = false; chkDisable.Visible = false; } - secLitigationHoldSettings.Visible = (Utils.CheckQouta(Quotas.EXCHANGE2007_ALLOWLITIGATIONHOLD, cntx)); + secLitigationHoldSettings.Visible = (Utils.CheckQouta(Quotas.EXCHANGE2007_ALLOWLITIGATIONHOLD, Cntx)); } } } - private bool CheckQouta(string key, PackageContext cntx) - { - return cntx.Quotas.ContainsKey(key) && - ((cntx.Quotas[key].QuotaAllocatedValue == 1 && cntx.Quotas[key].QuotaTypeId == 1) || - (cntx.Quotas[key].QuotaTypeId != 1 && (cntx.Quotas[key].QuotaAllocatedValue > 0 || cntx.Quotas[key].QuotaAllocatedValue == -1))); - } - private void BindSettings() { try @@ -118,11 +123,13 @@ namespace WebsitePanel.Portal.ExchangeServer if (account.ArchivingMailboxPlanId<1) { - mailboxArchivePlanSelector.MailboxPlanId = "-1"; + mailboxRetentionPolicySelector.MailboxPlanId = "-1"; + chkArchiving.Checked = false; } else { - mailboxArchivePlanSelector.MailboxPlanId = account.ArchivingMailboxPlanId.ToString(); + mailboxRetentionPolicySelector.MailboxPlanId = account.ArchivingMailboxPlanId.ToString(); + chkArchiving.Checked = true; } mailboxSize.QuotaUsedValue = Convert.ToInt32(stats.TotalSize / 1024 / 1024); @@ -135,8 +142,7 @@ namespace WebsitePanel.Portal.ExchangeServer litigationHoldSpace.QuotaUsedValue = Convert.ToInt32(stats.LitigationHoldTotalSize / 1024 / 1024); litigationHoldSpace.QuotaValue = (stats.LitigationHoldMaxSize == -1) ? -1 : (int)Math.Round((double)(stats.LitigationHoldMaxSize / 1024 / 1024)); - PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); - if (Utils.CheckQouta(Quotas.EXCHANGE2007_DISCLAIMERSALLOWED, cntx)) + if (Utils.CheckQouta(Quotas.EXCHANGE2007_DISCLAIMERSALLOWED, Cntx)) { int disclaimerId = ES.Services.ExchangeServer.GetExchangeAccountDisclaimerId(PanelRequest.ItemID, PanelRequest.AccountID); ddDisclaimer.SelectedValue = disclaimerId.ToString(); @@ -174,8 +180,14 @@ namespace WebsitePanel.Portal.ExchangeServer } else { - result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(PanelRequest.ItemID, PanelRequest.AccountID, Convert.ToInt32(mailboxPlanSelector.MailboxPlanId), - Convert.ToInt32(mailboxArchivePlanSelector.MailboxPlanId) ); + int planId = Convert.ToInt32(mailboxPlanSelector.MailboxPlanId); + int policyId = -1; + if (chkArchiving.Checked) + policyId = Convert.ToInt32(mailboxRetentionPolicySelector.MailboxPlanId); + + result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(PanelRequest.ItemID, PanelRequest.AccountID, planId, + policyId); + if (result < 0) { messageBox.ShowResultMessage(result); @@ -183,8 +195,7 @@ namespace WebsitePanel.Portal.ExchangeServer } } - PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); - if (Utils.CheckQouta(Quotas.EXCHANGE2007_DISCLAIMERSALLOWED, cntx)) + if (Utils.CheckQouta(Quotas.EXCHANGE2007_DISCLAIMERSALLOWED, Cntx)) { int disclaimerId; if (int.TryParse(ddDisclaimer.SelectedValue, out disclaimerId)) @@ -255,8 +266,33 @@ namespace WebsitePanel.Portal.ExchangeServer protected void chkArchiving_CheckedChanged(object sender, EventArgs e) { + SetArchivingVisible(); + } + + private void SetArchivingVisible() + { + int id; + if (!int.TryParse(mailboxPlanSelector.MailboxPlanId, out id)) + return; + + bool archiving = false; + + ExchangeMailboxPlan policy = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, id); + + if (policy != null) + archiving = policy.EnableArchiving & Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, Cntx); + + if (!archiving) + chkArchiving.Checked = false; + + secArchiving.Visible = archiving; mailboxArchivePlan.Visible = chkArchiving.Checked; } + protected void mailboxPlanSelector_Changed(object sender, EventArgs e) + { + SetArchivingVisible(); + } + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs index b79f3f0d..9aea4c2d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs @@ -12,15 +12,6 @@ namespace WebsitePanel.Portal.ExchangeServer { public partial class ExchangeMailboxGeneralSettings { - /// - /// asyncTasks control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - /// /// breadcrumb control. /// @@ -84,6 +75,15 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + /// + /// GeneralUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel GeneralUpdatePanel; + /// /// secGeneral control. /// @@ -102,15 +102,6 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::System.Web.UI.WebControls.Panel General; - /// - /// GeneralUpdatePanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.UpdatePanel GeneralUpdatePanel; - /// /// chkHideAddressBook control. /// @@ -201,15 +192,6 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::System.Web.UI.WebControls.Panel Archiving; - /// - /// ArchivingUpdatePanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.UpdatePanel ArchivingUpdatePanel; - /// /// chkArchiving control. /// @@ -229,22 +211,22 @@ namespace WebsitePanel.Portal.ExchangeServer { protected global::System.Web.UI.HtmlControls.HtmlTableRow mailboxArchivePlan; /// - /// locArchiveMailboxplanName control. + /// locRetentionPolicyName control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Localize locArchiveMailboxplanName; + protected global::System.Web.UI.WebControls.Localize locRetentionPolicyName; /// - /// mailboxArchivePlanSelector control. + /// mailboxRetentionPolicySelector control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxArchivePlanSelector; + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxRetentionPolicySelector; /// /// secLitigationHoldSettings control. 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 ad47bb16..19a94a88 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) 2012, 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,8 @@ namespace WebsitePanel.Portal.ExchangeServer protected void Page_Load(object sender, EventArgs e) { locTitle.Text = RetentionPolicy ? GetLocalizedString("locTitleRetentionPolicy.Text") : GetLocalizedString("locTitle.Text"); + gvMailboxPlans.Columns[2].Visible = !RetentionPolicy; + btnSetDefaultMailboxPlan.Visible = !RetentionPolicy; if (!IsPostBack) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx new file mode 100644 index 00000000..24819f20 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx @@ -0,0 +1,141 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ExchangeRetentionPolicyTag.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.ExchangeRetentionPolicyTag" %> +<%@ Register Src="UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %><%@ Register Src="UserControls/DaysBox.ascx" TagName="DaysBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/QuotaEditor.ascx" TagName="QuotaEditor" TagPrefix="uc1" %> +<%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> +<%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %> + +<%@ Import Namespace="WebsitePanel.Portal" %> + +
+
+
+ +
+
+ +
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + <%# PortalAntiXSS.Encode((string)Eval("TagName"))%> + + + + + + + + + + +   + + + + + +
+ + + + + + + + +
+ + + + +
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ +
+
+ +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+ + + + +
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx.cs new file mode 100644 index 00000000..a7aa6b11 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx.cs @@ -0,0 +1,238 @@ +// 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. + + +using System; +using System.IO; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Xml; +using System.Xml.Serialization; + +using System.Collections.Generic; +using System.Collections.ObjectModel; + +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal.ExchangeServer +{ + public partial class ExchangeRetentionPolicyTag : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + + if (!Page.IsPostBack) + { + BindRetentionPolicy(); + + string[] types = Enum.GetNames(typeof(ExchangeRetentionPolicyTagType)); + + ddTagType.Items.Clear(); + for (int i = 0; i < types.Length; i++) + ddTagType.Items.Add(new ListItem(types[i], i.ToString())); + + string[] action = Enum.GetNames(typeof(ExchangeRetentionPolicyTagAction)); + + ddRetentionAction.Items.Clear(); + for (int i = 0; i < action.Length; i++) + ddRetentionAction.Items.Add(new ListItem(action[i], i.ToString())); + } + + txtStatus.Visible = false; + + } + + + private void BindRetentionPolicy() + { + WebsitePanel.Providers.HostedSolution.ExchangeRetentionPolicyTag[] list = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTags(PanelRequest.ItemID); + + gvPolicy.DataSource = list; + gvPolicy.DataBind(); + + btnUpdatePolicy.Enabled = (string.IsNullOrEmpty(txtPolicy.Text)) ? false : true; + } + + + public void btnAddPolicy_Click(object sender, EventArgs e) + { + Page.Validate("CreatePolicy"); + + if (!Page.IsValid) + return; + + WebsitePanel.Providers.HostedSolution.ExchangeRetentionPolicyTag tag = new Providers.HostedSolution.ExchangeRetentionPolicyTag(); + tag.TagName = txtPolicy.Text; + tag.TagType = Convert.ToInt32(ddTagType.SelectedValue); + tag.AgeLimitForRetention = ageLimitForRetention.QuotaValue; + tag.RetentionAction = Convert.ToInt32(ddRetentionAction.SelectedValue); + + int result = ES.Services.ExchangeServer.AddExchangeRetentionPolicyTag(PanelRequest.ItemID, tag); + + if (result < 0) + { + ShowResultMessage(result); + return; + } + + BindRetentionPolicy(); + } + + protected void gvPolicy_RowCommand(object sender, GridViewCommandEventArgs e) + { + int mailboxPlanId = Utils.ParseInt(e.CommandArgument.ToString(), 0); + Providers.HostedSolution.ExchangeRetentionPolicyTag tag; + + switch (e.CommandName) + { + case "DeleteItem": + try + { + tag = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTag(PanelRequest.ItemID, mailboxPlanId); + + if (tag.ItemID != PanelRequest.ItemID) + { + ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN"); + BindRetentionPolicy(); + return; + } + + + int result = ES.Services.ExchangeServer.DeleteExchangeRetentionPolicyTag(PanelRequest.ItemID, mailboxPlanId); + if (result < 0) + { + ShowResultMessage(result); + return; + } + + ViewState["PolicyID"] = null; + + txtPolicy.Text = string.Empty; + ageLimitForRetention.QuotaValue = 0; + + btnUpdatePolicy.Enabled = (string.IsNullOrEmpty(txtPolicy.Text)) ? false : true; + + } + catch (Exception) + { + ShowErrorMessage("EXCHANGE_DELETE_MAILBOXPLAN"); + } + + BindRetentionPolicy(); + break; + + case "EditItem": + ViewState["PolicyID"] = mailboxPlanId; + + tag = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTag(PanelRequest.ItemID, mailboxPlanId); + + txtPolicy.Text = tag.TagName; + Utils.SelectListItem(ddTagType, tag.TagType); + ageLimitForRetention.QuotaValue = tag.AgeLimitForRetention; + Utils.SelectListItem(ddRetentionAction, tag.RetentionAction); + + btnUpdatePolicy.Enabled = (string.IsNullOrEmpty(txtPolicy.Text)) ? false : true; + + break; + } + } + + + public void SaveSettings(UserSettings settings) + { + settings["PolicyID"] = ""; + } + + + protected void btnUpdatePolicy_Click(object sender, EventArgs e) + { + + if (ViewState["PolicyID"] == null) + return; + + int mailboxPlanId = (int)ViewState["PolicyID"]; + Providers.HostedSolution.ExchangeRetentionPolicyTag tag; + + tag = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTag(PanelRequest.ItemID, mailboxPlanId); + + if (tag.ItemID != PanelRequest.ItemID) + { + ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN"); + BindRetentionPolicy(); + return; + } + + + tag.TagName = txtPolicy.Text; + tag.TagType = Convert.ToInt32(ddTagType.SelectedValue); + tag.AgeLimitForRetention = ageLimitForRetention.QuotaValue; + tag.RetentionAction = Convert.ToInt32(ddRetentionAction.SelectedValue); + + int result = ES.Services.ExchangeServer.UpdateExchangeRetentionPolicyTag(PanelRequest.ItemID, tag); + + if (result < 0) + { + ShowErrorMessage("EXCHANGE_UPDATEPLANS"); + } + else + { + ShowSuccessMessage("EXCHANGE_UPDATEPLANS"); + } + + BindRetentionPolicy(); + } + + + protected void txtPolicy_TextChanged(object sender, EventArgs e) + { + btnUpdatePolicy.Enabled = (string.IsNullOrEmpty(txtPolicy.Text)) ? false : true; + } + + public string GetTagType(int ItemID) + { + string imgName = string.Empty; + + if (ItemID == PanelRequest.ItemID) + imgName = "admin_16.png"; + else + imgName = "company24.png"; + + return GetThemedImage("Exchange/" + imgName); + } + + } +} \ 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 new file mode 100644 index 00000000..5115c0b3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeRetentionPolicyTag.ascx.designer.cs @@ -0,0 +1,204 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ExchangeServer { + + + public partial class ExchangeRetentionPolicyTag { + + /// + /// 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. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// gvPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvPolicy; + + /// + /// secPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPolicy; + + /// + /// Policy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel Policy; + + /// + /// txtPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPolicy; + + /// + /// valRequirePolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequirePolicy; + + /// + /// secPolicyFeatures control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPolicyFeatures; + + /// + /// PolicyFeatures control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel PolicyFeatures; + + /// + /// locType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locType; + + /// + /// ddTagType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddTagType; + + /// + /// locAgeLimitForRetention control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locAgeLimitForRetention; + + /// + /// ageLimitForRetention control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor ageLimitForRetention; + + /// + /// locRetentionAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locRetentionAction; + + /// + /// ddRetentionAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddRetentionAction; + + /// + /// btnAddPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddPolicy; + + /// + /// btnUpdatePolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnUpdatePolicy; + + /// + /// txtStatus control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtStatus; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/Menu.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/Menu.ascx.resx index f94469b7..c66a3c75 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/Menu.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/Menu.ascx.resx @@ -222,4 +222,7 @@ Retention Policy + + Retention Policy Tag + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx index 5b5fb121..725d38f0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx @@ -1,2 +1,2 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MailboxPlanSelector.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector" %> - \ No newline at end of file + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx.cs index 7c4ea1d5..54c513d5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx.cs @@ -33,25 +33,33 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls { public partial class MailboxPlanSelector : WebsitePanelControlBase { + private void UpdateMailboxPlanSelected() + { + foreach (ListItem li in ddlMailboxPlan.Items) + { + if (li.Value == mailboxPlanToSelect) + { + ddlMailboxPlan.ClearSelection(); + li.Selected = true; + break; + } + } - private string mailboxPlanToSelect; + } + + private string mailboxPlanToSelect = null; public string MailboxPlanId { - - get { return ddlMailboxPlan.SelectedItem.Value; } - set - { - mailboxPlanToSelect = value; - foreach (ListItem li in ddlMailboxPlan.Items) - { - if (li.Value == value) - { - ddlMailboxPlan.ClearSelection(); - li.Selected = true; - break; - } - } + get { + if (ddlMailboxPlan.SelectedItem != null) + return ddlMailboxPlan.SelectedItem.Value; + return mailboxPlanToSelect; + } + set + { + mailboxPlanToSelect = value; + UpdateMailboxPlanSelected(); } } @@ -86,8 +94,14 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls } } + protected void Page_PreRender(object sender, EventArgs e) + { + ddlMailboxPlan.AutoPostBack = (Changed!=null); + } + private void BindMailboxPlans() { + WebsitePanel.Providers.HostedSolution.ExchangeMailboxPlan[] plans = ES.Services.ExchangeServer.GetExchangeMailboxPlans(PanelRequest.ItemID, Archiving); if (AddNone) @@ -108,20 +122,17 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls ddlMailboxPlan.Items.Add(li); } + UpdateMailboxPlanSelected(); - if (!string.IsNullOrEmpty(mailboxPlanToSelect)) + } + + public event EventHandler Changed = null; + protected void ddlMailboxPlan_SelectedIndexChanged(object sender, EventArgs e) + { + if (Changed != null) { - foreach (ListItem li in ddlMailboxPlan.Items) - { - if (li.Value == mailboxPlanToSelect) - { - ddlMailboxPlan.ClearSelection(); - li.Selected = true; - break; - } - } + Changed(this, e); } - } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx.designer.cs index b2e653d3..e1388046 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/MailboxPlanSelector.ascx.designer.cs @@ -1,33 +1,4 @@ -// Copyright (c) 2012, 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. // 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 383497aa..0806d293 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 @@ -144,6 +144,10 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls if (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx)) exchangeGroup.MenuItems.Add(CreateMenuItem("RetentionPolicy", "retentionpolicy")); + if (!hideItems) + if (Utils.CheckQouta(Quotas.EXCHANGE2013_ALLOWARCHIVING, cntx)) + exchangeGroup.MenuItems.Add(CreateMenuItem("RetentionPolicyTag", "retentionpolicytag")); + if (!hideItems) if (Utils.CheckQouta(Quotas.EXCHANGE2007_MAILBOXES, cntx)) exchangeGroup.MenuItems.Add(CreateMenuItem("ExchangeDomainNames", "domains")); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx index 18c41cdd..9ba5ee59 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx @@ -12,7 +12,7 @@ - + @@ -22,7 +22,7 @@ - + <%# PortalAntiXSS.Encode((string)Eval("MailboxPlan"))%> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.cs index 71e05fe9..1eb5b4b6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.cs @@ -71,8 +71,8 @@ namespace WebsitePanel.Portal secMailboxFeatures.Visible = !RetentionPolicy; secMailboxGeneral.Visible = !RetentionPolicy; - gvMailboxPlans.Columns[2].Visible = !RetentionPolicy; - gvMailboxPlans.Columns[3].Visible = !RetentionPolicy; + gvMailboxPlans.Columns[4].Visible = !RetentionPolicy; + gvMailboxPlans.Columns[5].Visible = !RetentionPolicy; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx new file mode 100644 index 00000000..03bee3b4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx @@ -0,0 +1,109 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SettingsExchangeRetentionPolicyTag.ascx.cs" Inherits="WebsitePanel.Portal.SettingsExchangeRetentionPolicyTag" %> +<%@ Register Src="ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> +<%@ Register Src="ExchangeServer/UserControls/DaysBox.ascx" TagName="DaysBox" TagPrefix="wsp" %> +<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> +<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register Src="UserControls/QuotaEditor.ascx" TagName="QuotaEditor" TagPrefix="uc1" %> +<%@ Import Namespace="WebsitePanel.Portal" %> + + + + + + + + + + + + + + <%# PortalAntiXSS.Encode((string)Eval("TagName"))%> + + + + +   + + + + +
+ + + + + + + + +
+ + + + +
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+ + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx.cs new file mode 100644 index 00000000..246de1bc --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx.cs @@ -0,0 +1,314 @@ +// 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. + + +using System; +using System.IO; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Xml; +using System.Xml.Serialization; + +using System.Collections.Generic; +using System.Collections.ObjectModel; + +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal +{ + public partial class SettingsExchangeRetentionPolicyTag : WebsitePanelControlBase, IUserSettingsEditorControl + { + + + public void BindSettings(UserSettings settings) + { + BindRetentionPolicy(); + + + string[] types = Enum.GetNames(typeof(ExchangeRetentionPolicyTagType)); + + ddTagType.Items.Clear(); + for (int i = 0; i < types.Length; i++) + ddTagType.Items.Add(new ListItem(types[i], i.ToString())); + + string[] action = Enum.GetNames(typeof(ExchangeRetentionPolicyTagAction)); + + ddRetentionAction.Items.Clear(); + for (int i = 0; i < action.Length; i++) + ddRetentionAction.Items.Add(new ListItem(action[i], i.ToString())); + + txtStatus.Visible = false; + } + + + private void BindRetentionPolicy() + { + Providers.HostedSolution.Organization[] orgs = null; + + if (PanelSecurity.SelectedUserId != 1) + { + PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId); + + if ((Packages != null) & (Packages.GetLength(0) > 0)) + { + orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false); + } + } + else + { + orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false); + } + + if ((orgs != null) & (orgs.GetLength(0) > 0)) + { + ExchangeRetentionPolicyTag[] list = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTags(orgs[0].Id); + + gvPolicy.DataSource = list; + gvPolicy.DataBind(); + } + + btnUpdatePolicy.Enabled = (string.IsNullOrEmpty(txtPolicy.Text)) ? false : true; + } + + + public void btnAddPolicy_Click(object sender, EventArgs e) + { + Page.Validate("CreatePolicy"); + + if (!Page.IsValid) + return; + + ExchangeRetentionPolicyTag tag = new ExchangeRetentionPolicyTag(); + tag.TagName = txtPolicy.Text; + tag.TagType = Convert.ToInt32(ddTagType.SelectedValue); + tag.AgeLimitForRetention = ageLimitForRetention.QuotaValue; + tag.RetentionAction = Convert.ToInt32(ddRetentionAction.SelectedValue); + + Providers.HostedSolution.Organization[] orgs = null; + if (PanelSecurity.SelectedUserId != 1) + { + PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId); + + if ((Packages != null) & (Packages.GetLength(0) > 0)) + { + orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false); + } + } + else + { + orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false); + } + + + if ((orgs != null) & (orgs.GetLength(0) > 0)) + { + int result = ES.Services.ExchangeServer.AddExchangeRetentionPolicyTag(orgs[0].Id, tag); + + if (result < 0) + { + messageBox.ShowResultMessage(result); + return; + } + } + + BindRetentionPolicy(); + + } + + protected void gvPolicy_RowCommand(object sender, GridViewCommandEventArgs e) + { + int mailboxPlanId = Utils.ParseInt(e.CommandArgument.ToString(), 0); + Providers.HostedSolution.Organization[] orgs = null; + Providers.HostedSolution.ExchangeRetentionPolicyTag tag; + + switch (e.CommandName) + { + case "DeleteItem": + try + { + + if (PanelSecurity.SelectedUserId != 1) + { + PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId); + + if ((Packages != null) & (Packages.GetLength(0) > 0)) + { + orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false); + } + } + else + { + orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false); + } + + tag = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTag(orgs[0].Id, mailboxPlanId); + + if (tag.ItemID != orgs[0].Id) + { + messageBox.ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN"); + BindRetentionPolicy(); + return; + } + + + int result = ES.Services.ExchangeServer.DeleteExchangeRetentionPolicyTag(orgs[0].Id, mailboxPlanId); + if (result < 0) + { + messageBox.ShowResultMessage(result); + return; + } + + ViewState["PolicyID"] = null; + + txtPolicy.Text = string.Empty; + ageLimitForRetention.QuotaValue = 0; + + btnUpdatePolicy.Enabled = (string.IsNullOrEmpty(txtPolicy.Text)) ? false : true; + + } + catch (Exception) + { + messageBox.ShowErrorMessage("EXCHANGE_DELETE_MAILBOXPLAN"); + } + + BindRetentionPolicy(); + break; + + case "EditItem": + ViewState["PolicyID"] = mailboxPlanId; + + if (PanelSecurity.SelectedUserId != 1) + { + PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId); + + if ((Packages != null) & (Packages.GetLength(0) > 0)) + { + orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false); + } + } + else + { + orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false); + } + + + tag = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTag(orgs[0].Id, mailboxPlanId); + + txtPolicy.Text = tag.TagName; + Utils.SelectListItem(ddTagType, tag.TagType); + ageLimitForRetention.QuotaValue = tag.AgeLimitForRetention; + Utils.SelectListItem(ddRetentionAction, tag.RetentionAction); + + btnUpdatePolicy.Enabled = (string.IsNullOrEmpty(txtPolicy.Text)) ? false : true; + + break; + } + } + + + public void SaveSettings(UserSettings settings) + { + settings["PolicyID"] = ""; + } + + + protected void btnUpdatePolicy_Click(object sender, EventArgs e) + { + + if (ViewState["PolicyID"] == null) + return; + + int mailboxPlanId = (int)ViewState["PolicyID"]; + Providers.HostedSolution.Organization[] orgs = null; + Providers.HostedSolution.ExchangeRetentionPolicyTag tag; + + + if (PanelSecurity.SelectedUserId != 1) + { + PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId); + + if ((Packages != null) & (Packages.GetLength(0) > 0)) + { + orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false); + } + } + else + { + orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false); + } + + tag = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTag(orgs[0].Id, mailboxPlanId); + + if (tag.ItemID != orgs[0].Id) + { + messageBox.ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN"); + BindRetentionPolicy(); + return; + } + + + tag.TagName = txtPolicy.Text; + tag.TagType = Convert.ToInt32(ddTagType.SelectedValue); + tag.AgeLimitForRetention = ageLimitForRetention.QuotaValue; + tag.RetentionAction = Convert.ToInt32(ddRetentionAction.SelectedValue); + + if ((orgs != null) & (orgs.GetLength(0) > 0)) + { + int result = ES.Services.ExchangeServer.UpdateExchangeRetentionPolicyTag(orgs[0].Id, tag); + + if (result < 0) + { + messageBox.ShowErrorMessage("EXCHANGE_UPDATEPLANS"); + } + else + { + messageBox.ShowSuccessMessage("EXCHANGE_UPDATEPLANS"); + } + } + + BindRetentionPolicy(); + } + + + protected void txtPolicy_TextChanged(object sender, EventArgs e) + { + btnUpdatePolicy.Enabled = (string.IsNullOrEmpty(txtPolicy.Text)) ? false : true; + } + + + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx.designer.cs new file mode 100644 index 00000000..74e2f31c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeRetentionPolicyTag.ascx.designer.cs @@ -0,0 +1,177 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class SettingsExchangeRetentionPolicyTag { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// gvPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvPolicy; + + /// + /// secPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPolicy; + + /// + /// Policy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel Policy; + + /// + /// txtPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPolicy; + + /// + /// valRequirePolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequirePolicy; + + /// + /// secPolicyFeatures control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPolicyFeatures; + + /// + /// PolicyFeatures control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel PolicyFeatures; + + /// + /// locType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locType; + + /// + /// ddTagType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddTagType; + + /// + /// locAgeLimitForRetention control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locAgeLimitForRetention; + + /// + /// ageLimitForRetention control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor ageLimitForRetention; + + /// + /// locRetentionAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locRetentionAction; + + /// + /// ddRetentionAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddRetentionAction; + + /// + /// btnAddPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddPolicy; + + /// + /// btnUpdatePolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnUpdatePolicy; + + /// + /// txtStatus control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtStatus; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx index f9aa50a5..4027111c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx @@ -19,7 +19,7 @@
  • + Text="Global Retention Policy Tag" NavigateUrl='<%# GetSettingsLink("RetentionPolicyTag", "SettingsExchangeRetentionPolicyTag") %>'>
  • diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index a379d819..9a641e25 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -315,6 +315,13 @@ OrganizationUserMemberOf.ascx + + ExchangeRetentionPolicyTag.ascx + ASPXCodeBehind + + + ExchangeRetentionPolicyTag.ascx + AccountsListWithPermissions.ascx ASPXCodeBehind @@ -536,6 +543,13 @@ NotifyOverusedDatabases.ascx ASPXCodeBehind + + SettingsExchangeRetentionPolicyTag.ascx + ASPXCodeBehind + + + SettingsExchangeRetentionPolicyTag.ascx + SettingsExchangeMailboxPlansPolicy.ascx ASPXCodeBehind @@ -4060,6 +4074,7 @@ + @@ -4091,6 +4106,7 @@ + @@ -5298,6 +5314,8 @@ Designer + + Designer