Added the ability to stamp mailboxes with a mailbox plan as well as those
mailboxes that have no mailbox plan assigned yet. The following SQL statement will 'upgrade' the user data to work with the new exchange 2010 SP2 provider. Ensure you replace the variables with values that matches your environment. DECLARE @NetBIOSDomain nvarchar(20) DECLARE @ExchangeOrgRoot nvarchar(256) SET @NetBIOSDomain = 'MYDOMAIN' SET @ExchangeOrgRoot = 'CN=First Organization,CN=Microsoft Exchange,CN=Services, CN=Configuration,DC=mydomain,DC=local' UPDATE ExchangeAccounts SET SamAccountName = @NetBIOSDomain+'\'+AccountName WHERE AccountID IN (SELECT AccountID FROM ExchangeAccounts WHERE AccountType IN (3,7) AND SamAccountName = '') INSERT INTO ServiceItemProperties (ItemID, PropertyName, PropertyValue) (SELECT SP.ItemID, 'AddressBookPolicy', PV = 'CN='+SP.PropertyValue+' Address Policy,CN=AddressBook Mailbox Policies,' + @ExchangeOrgRoot FROM ServiceItemProperties AS SP WHERE (PropertyName = 'OrganizationID') AND (ItemID IN (SELECT ItemID FROM ServiceItemProperties AS ServiceItemProperties_1 WHERE (PropertyName = 'GlobalAddressList') AND (PropertyValue <> '')))) UPDATE SP SET PropertyValue='CN='+SP2.PropertyValue+' Rooms,CN=All Address Lists ,CN=Address Lists Container,'+@ExchangeOrgRoot FROM ServiceItemProperties AS SP JOIN ServiceItemProperties AS SP2 ON SP.ItemID = SP2.ItemID AND SP.PropertyName='RoomsAddressList' WHERE (SP2.PropertyName = 'OrganizationID') AND (SP2.ItemID IN (SELECT ItemID FROM ServiceItemProperties AS ServiceItemProperties_1 WHERE (PropertyName = 'GlobalAddressList') AND (PropertyValue <> '')))
This commit is contained in:
parent
80672a555f
commit
43b73aee66
15 changed files with 469 additions and 36 deletions
|
@ -120,6 +120,9 @@
|
|||
<data name="btnAddMailboxPlan.Text" xml:space="preserve">
|
||||
<value>Add New Mailbox plan</value>
|
||||
</data>
|
||||
<data name="btnSave.Text" xml:space="preserve">
|
||||
<value>Stamp mailboxes</value>
|
||||
</data>
|
||||
<data name="btnSetDefaultMailboxPlan.Text" xml:space="preserve">
|
||||
<value>Set Default Mailbox plan</value>
|
||||
</data>
|
||||
|
@ -144,9 +147,18 @@
|
|||
<data name="HSFormComments.Text" xml:space="preserve">
|
||||
<value><p> A Mailbox plan is a template that defines the characteristics of a mailbox </p> <p>The mailbox plan name needs to be unique. A mailbox plan cannot be modified. In case a mailbox needs a mailbox plan with another characteristics, a new mailbox plan needs to be created and assigned to the mailbox. A mailbox plan can only be deleted when the plan is not assigned to any mailboxes. </p></value>
|
||||
</data>
|
||||
<data name="locSourcePlan.Text" xml:space="preserve">
|
||||
<value>Source plan: </value>
|
||||
</data>
|
||||
<data name="locTargetPlan.Text" xml:space="preserve">
|
||||
<value>Target plan: </value>
|
||||
</data>
|
||||
<data name="locTitle.Text" xml:space="preserve">
|
||||
<value>Mailbox plans</value>
|
||||
</data>
|
||||
<data name="secMainTools.Text" xml:space="preserve">
|
||||
<value>Mailbox plan maintenance</value>
|
||||
</data>
|
||||
<data name="Text.PageName" xml:space="preserve">
|
||||
<value>Mailbox plans</value>
|
||||
</data>
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
<%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %>
|
||||
<%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %>
|
||||
<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %>
|
||||
<%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %>
|
||||
<%@ Register Src="UserControls/MailboxPlanSelector.ascx" TagName="MailboxPlanSelector" TagPrefix="wsp" %>
|
||||
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
|
||||
|
||||
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
|
||||
|
@ -62,7 +64,44 @@
|
|||
<asp:Button ID="btnSetDefaultMailboxPlan" runat="server" meta:resourcekey="btnSetDefaultMailboxPlan"
|
||||
Text="Set Default Mailboxplan" CssClass="Button1" OnClick="btnSetDefaultMailboxPlan_Click" />
|
||||
</div>
|
||||
|
||||
|
||||
<wsp:CollapsiblePanel id="secMainTools" runat="server" IsCollapsed="true" TargetControlID="ToolsPanel" meta:resourcekey="secMainTools" Text="Mailbox plan maintenance">
|
||||
</wsp:CollapsiblePanel>
|
||||
<asp:Panel ID="ToolsPanel" runat="server" Height="0" Style="overflow: hidden;">
|
||||
<table id="tblMaintenance" runat="server" cellpadding="10">
|
||||
<tr>
|
||||
<td class="FormLabel150"><asp:Localize ID="lblSourcePlan" runat="server" meta:resourcekey="locSourcePlan" Text="Replace"></asp:Localize></td>
|
||||
<td>
|
||||
<wsp:MailboxPlanSelector ID="mailboxPlanSelectorSource" runat="server" AddNone="true"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="FormLabel150"><asp:Localize ID="lblTargetPlan" runat="server" meta:resourcekey="locTargetPlan" Text="With"></asp:Localize></td>
|
||||
<td>
|
||||
<wsp:MailboxPlanSelector ID="mailboxPlanSelectorTarget" runat="server" AddNone="false"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<asp:TextBox ID="txtStatus" runat="server" CssClass="TextBox200" MaxLength="128" ReadOnly="true"></asp:TextBox>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="FormFooterClean">
|
||||
<asp:Button id="btnSave" runat="server" Text="Stamp mailboxes" CssClass="Button1"
|
||||
meta:resourcekey="btnSave" OnClick="btnSave_Click" OnClientClick = "ShowProgressDialog('Stamping mailboxes, this might take a while ...');"> </asp:Button>
|
||||
</div>
|
||||
|
||||
|
||||
</asp:Panel>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="Right">
|
||||
|
|
|
@ -41,8 +41,9 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
{
|
||||
// bind mailboxplans
|
||||
BindMailboxPlans();
|
||||
}
|
||||
|
||||
txtStatus.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetMailboxPlanDisplayUrl(string MailboxPlanId)
|
||||
|
@ -65,6 +66,9 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
{
|
||||
btnSetDefaultMailboxPlan.Enabled = false;
|
||||
}
|
||||
|
||||
btnSave.Enabled = (gvMailboxPlans.Rows.Count >= 1);
|
||||
|
||||
}
|
||||
|
||||
public string IsChecked(bool val)
|
||||
|
@ -122,5 +126,31 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
ShowErrorMessage("EXCHANGE_SET_DEFAULT_MAILBOXPLAN", ex);
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
txtStatus.Visible = true;
|
||||
|
||||
try
|
||||
{
|
||||
ExchangeAccount[] Accounts = ES.Services.ExchangeServer.GetExchangeAccountByMailboxPlanId(PanelRequest.ItemID, Convert.ToInt32(mailboxPlanSelectorSource.MailboxPlanId));
|
||||
|
||||
foreach (ExchangeAccount a in Accounts)
|
||||
{
|
||||
txtStatus.Text = "Completed";
|
||||
int result = ES.Services.ExchangeServer.SetExchangeMailboxPlan(PanelRequest.ItemID, a.AccountId, Convert.ToInt32(mailboxPlanSelectorTarget.MailboxPlanId));
|
||||
if (result < 0)
|
||||
{
|
||||
txtStatus.Text = "Error: " + a.AccountName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowErrorMessage("EXCHANGE_FAILED_TO_STAMP", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,11 +7,13 @@
|
|||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WebsitePanel.Portal.ExchangeServer {
|
||||
|
||||
|
||||
public partial class ExchangeMailboxPlans {
|
||||
|
||||
namespace WebsitePanel.Portal.ExchangeServer
|
||||
{
|
||||
|
||||
|
||||
public partial class ExchangeMailboxPlans
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// asyncTasks control.
|
||||
/// </summary>
|
||||
|
@ -20,7 +22,7 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// breadcrumb control.
|
||||
/// </summary>
|
||||
|
@ -29,7 +31,7 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// menu control.
|
||||
/// </summary>
|
||||
|
@ -38,7 +40,7 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Image1 control.
|
||||
/// </summary>
|
||||
|
@ -47,7 +49,7 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Image Image1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// locTitle control.
|
||||
/// </summary>
|
||||
|
@ -56,7 +58,7 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Localize locTitle;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// messageBox control.
|
||||
/// </summary>
|
||||
|
@ -65,7 +67,7 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnAddMailboxPlan control.
|
||||
/// </summary>
|
||||
|
@ -74,7 +76,7 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button btnAddMailboxPlan;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// gvMailboxPlans control.
|
||||
/// </summary>
|
||||
|
@ -83,7 +85,7 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView gvMailboxPlans;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSetDefaultMailboxPlan control.
|
||||
/// </summary>
|
||||
|
@ -92,7 +94,88 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button btnSetDefaultMailboxPlan;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// secMainTools control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.CollapsiblePanel secMainTools;
|
||||
|
||||
/// <summary>
|
||||
/// ToolsPanel control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel ToolsPanel;
|
||||
|
||||
/// <summary>
|
||||
/// tblMaintenance control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlTable tblMaintenance;
|
||||
|
||||
/// <summary>
|
||||
/// lblSourcePlan control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Localize lblSourcePlan;
|
||||
|
||||
/// <summary>
|
||||
/// mailboxPlanSelectorSource control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelectorSource;
|
||||
|
||||
/// <summary>
|
||||
/// lblTargetPlan control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Localize lblTargetPlan;
|
||||
|
||||
/// <summary>
|
||||
/// mailboxPlanSelectorTarget control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector mailboxPlanSelectorTarget;
|
||||
|
||||
/// <summary>
|
||||
/// txtStatus control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txtStatus;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button btnSave;
|
||||
|
||||
/// <summary>
|
||||
/// FormComments control.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MailboxPlanSelector.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.MailboxPlanSelector" %>
|
||||
<asp:DropDownList ID="ddlMailboxPlan" runat="server" CssClass="NormalTextBox"
|
||||
onselectedindexchanged="ddlMailboxPlan_SelectedIndexChanged"></asp:DropDownList>
|
||||
<asp:DropDownList ID="ddlMailboxPlan" runat="server" CssClass="NormalTextBox"></asp:DropDownList>
|
|
@ -35,6 +35,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
{
|
||||
|
||||
private string mailboxPlanToSelect;
|
||||
private bool addNone;
|
||||
|
||||
public string MailboxPlanId
|
||||
{
|
||||
|
@ -55,6 +56,13 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
}
|
||||
}
|
||||
|
||||
public bool AddNone
|
||||
{
|
||||
get { return ViewState["AddNone"] != null ? (bool)ViewState["AddNone"] : false; }
|
||||
set { ViewState["AddNone"] = value; }
|
||||
}
|
||||
|
||||
|
||||
public int MailboxPlansCount
|
||||
{
|
||||
get
|
||||
|
@ -85,21 +93,29 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
|
|||
ddlMailboxPlan.Items.Add(li);
|
||||
}
|
||||
|
||||
foreach (ListItem li in ddlMailboxPlan.Items)
|
||||
if (AddNone)
|
||||
{
|
||||
if (li.Value == mailboxPlanToSelect)
|
||||
ListItem li = new ListItem();
|
||||
li.Text = "[None]";
|
||||
li.Value = "-1";
|
||||
li.Selected = false;
|
||||
ddlMailboxPlan.Items.Add(li);
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(mailboxPlanToSelect))
|
||||
{
|
||||
foreach (ListItem li in ddlMailboxPlan.Items)
|
||||
{
|
||||
ddlMailboxPlan.ClearSelection();
|
||||
li.Selected = true;
|
||||
break;
|
||||
if (li.Value == mailboxPlanToSelect)
|
||||
{
|
||||
ddlMailboxPlan.ClearSelection();
|
||||
li.Selected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void ddlMailboxPlan_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue