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:
robvde 2012-07-12 17:14:19 +04:00
parent 80672a555f
commit 43b73aee66
15 changed files with 469 additions and 36 deletions

View file

@ -20,14 +20,12 @@ namespace WebsitePanel.EnterpriseServer {
using System.Diagnostics;
using System.Data;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.ResultObjects;
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
@ -71,6 +69,8 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback GetAccountsOperationCompleted;
private System.Threading.SendOrPostCallback GetExchangeAccountByMailboxPlanIdOperationCompleted;
private System.Threading.SendOrPostCallback SearchAccountsOperationCompleted;
private System.Threading.SendOrPostCallback GetAccountOperationCompleted;
@ -251,6 +251,9 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
public event GetAccountsCompletedEventHandler GetAccountsCompleted;
/// <remarks/>
public event GetExchangeAccountByMailboxPlanIdCompletedEventHandler GetExchangeAccountByMailboxPlanIdCompleted;
/// <remarks/>
public event SearchAccountsCompletedEventHandler SearchAccountsCompleted;
@ -1337,6 +1340,50 @@ namespace WebsitePanel.EnterpriseServer {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetExchangeAccountByMailboxPlanId", 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 ExchangeAccount[] GetExchangeAccountByMailboxPlanId(int itemId, int mailboxPlanId) {
object[] results = this.Invoke("GetExchangeAccountByMailboxPlanId", new object[] {
itemId,
mailboxPlanId});
return ((ExchangeAccount[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetExchangeAccountByMailboxPlanId(int itemId, int mailboxPlanId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetExchangeAccountByMailboxPlanId", new object[] {
itemId,
mailboxPlanId}, callback, asyncState);
}
/// <remarks/>
public ExchangeAccount[] EndGetExchangeAccountByMailboxPlanId(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ExchangeAccount[])(results[0]));
}
/// <remarks/>
public void GetExchangeAccountByMailboxPlanIdAsync(int itemId, int mailboxPlanId) {
this.GetExchangeAccountByMailboxPlanIdAsync(itemId, mailboxPlanId, null);
}
/// <remarks/>
public void GetExchangeAccountByMailboxPlanIdAsync(int itemId, int mailboxPlanId, object userState) {
if ((this.GetExchangeAccountByMailboxPlanIdOperationCompleted == null)) {
this.GetExchangeAccountByMailboxPlanIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetExchangeAccountByMailboxPlanIdOperationCompleted);
}
this.InvokeAsync("GetExchangeAccountByMailboxPlanId", new object[] {
itemId,
mailboxPlanId}, this.GetExchangeAccountByMailboxPlanIdOperationCompleted, userState);
}
private void OnGetExchangeAccountByMailboxPlanIdOperationCompleted(object arg) {
if ((this.GetExchangeAccountByMailboxPlanIdCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetExchangeAccountByMailboxPlanIdCompleted(this, new GetExchangeAccountByMailboxPlanIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SearchAccounts", 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 ExchangeAccount[] SearchAccounts(int itemId, bool includeMailboxes, bool includeContacts, bool includeDistributionLists, bool includeRooms, bool includeEquipment, string filterColumn, string filterValue, string sortColumn) {
@ -4912,6 +4959,32 @@ namespace WebsitePanel.EnterpriseServer {
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetExchangeAccountByMailboxPlanIdCompletedEventHandler(object sender, GetExchangeAccountByMailboxPlanIdCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetExchangeAccountByMailboxPlanIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetExchangeAccountByMailboxPlanIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public ExchangeAccount[] Result {
get {
this.RaiseExceptionIfNecessary();
return ((ExchangeAccount[])(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void SearchAccountsCompletedEventHandler(object sender, SearchAccountsCompletedEventArgs e);