From 695c0bc94f7fc6fb482dc06891af17a761807721 Mon Sep 17 00:00:00 2001 From: robvde Date: Sat, 24 Nov 2012 22:17:37 +0400 Subject: [PATCH] Replaced upn by samaccountname as accountname in exchange accounts ContactGeneralSettings reformatted --- .../ExchangeServerController.cs | 31 +++++++------ .../HostedSolution/OrganizationController.cs | 11 +++-- .../OrganizationProvider.cs | 2 +- .../ExchangeContactGeneralSettings.ascx | 23 +++++----- ...ngeContactGeneralSettings.ascx.designer.cs | 45 ++++++++----------- 5 files changed, 55 insertions(+), 57 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs index e012ee65..e4fccf87 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/ExchangeServer/ExchangeServerController.cs @@ -767,7 +767,7 @@ namespace WebsitePanel.EnterpriseServer // load account ExchangeAccount account = GetAccount(itemId, accountId); - return exchange.GetMailboxStatistics(account.AccountName); + return exchange.GetMailboxStatistics(account.UserPrincipalName); } catch (Exception ex) { @@ -1241,6 +1241,9 @@ namespace WebsitePanel.EnterpriseServer string CounterStr = "00000"; int counter = 0; bool bFound = false; + + if (!AccountExists(accountName)) return accountName; + do { accountName = genSamLogin(name, CounterStr); @@ -1819,7 +1822,7 @@ namespace WebsitePanel.EnterpriseServer // delete mailbox int serviceExchangeId = GetExchangeServiceID(org.PackageId); ExchangeServer exchange = GetExchangeServer(serviceExchangeId, org.ServiceId); - exchange.DisableMailbox(account.AccountName); + exchange.DisableMailbox(account.UserPrincipalName); account.AccountType = ExchangeAccountType.User; account.MailEnabledPublicFolder = false; @@ -1869,7 +1872,7 @@ namespace WebsitePanel.EnterpriseServer // delete mailbox int serviceExchangeId = GetExchangeServiceID(org.PackageId); ExchangeServer exchange = GetExchangeServer(serviceExchangeId, org.ServiceId); - exchange.DeleteMailbox(account.AccountName); + exchange.DeleteMailbox(account.UserPrincipalName); @@ -1944,7 +1947,7 @@ namespace WebsitePanel.EnterpriseServer int exchangeServiceId = GetExchangeServiceID(org.PackageId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); - return exchange.GetMailboxGeneralSettings(account.AccountName); + return exchange.GetMailboxGeneralSettings(account.UserPrincipalName); } catch (Exception ex) { @@ -1991,7 +1994,7 @@ namespace WebsitePanel.EnterpriseServer hideAddressBook = true; exchange.SetMailboxGeneralSettings( - account.AccountName, + account.UserPrincipalName, hideAddressBook, disabled); @@ -2063,7 +2066,7 @@ namespace WebsitePanel.EnterpriseServer ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); exchange.SetMailboxEmailAddresses( - account.AccountName, + account.UserPrincipalName, GetAccountSimpleEmailAddresses(itemId, accountId)); return 0; @@ -2119,7 +2122,7 @@ namespace WebsitePanel.EnterpriseServer ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); exchange.SetMailboxPrimaryEmailAddress( - account.AccountName, + account.UserPrincipalName, emailAddress); if (DataProvider.CheckOCSUserExists(account.AccountId)) @@ -2187,7 +2190,7 @@ namespace WebsitePanel.EnterpriseServer ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); exchange.SetMailboxEmailAddresses( - account.AccountName, + account.UserPrincipalName, GetAccountSimpleEmailAddresses(itemId, accountId)); return 0; @@ -2228,7 +2231,7 @@ namespace WebsitePanel.EnterpriseServer // get mailbox settings int exchangeServiceId = GetExchangeServiceID(org.PackageId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); - ExchangeMailbox mailbox = exchange.GetMailboxMailFlowSettings(account.AccountName); + ExchangeMailbox mailbox = exchange.GetMailboxMailFlowSettings(account.UserPrincipalName); mailbox.DisplayName = account.DisplayName; return mailbox; } @@ -2273,7 +2276,7 @@ namespace WebsitePanel.EnterpriseServer int exchangeServiceId = GetExchangeServiceID(org.PackageId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); - exchange.SetMailboxMailFlowSettings(account.AccountName, + exchange.SetMailboxMailFlowSettings(account.UserPrincipalName, enableForwarding, forwardingAccountName, forwardToBoth, @@ -2321,7 +2324,7 @@ namespace WebsitePanel.EnterpriseServer // get mailbox settings int exchangeServiceId = GetExchangeServiceID(org.PackageId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); - ExchangeMailbox mailbox = exchange.GetMailboxAdvancedSettings(account.AccountName); + ExchangeMailbox mailbox = exchange.GetMailboxAdvancedSettings(account.UserPrincipalName); mailbox.DisplayName = account.DisplayName; return mailbox; } @@ -2529,7 +2532,7 @@ namespace WebsitePanel.EnterpriseServer // get mailbox settings int exchangeServiceId = GetExchangeServiceID(org.PackageId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); - ExchangeMailbox mailbox = exchange.GetMailboxPermissions(org.OrganizationId, account.AccountName); + ExchangeMailbox mailbox = exchange.GetMailboxPermissions(org.OrganizationId, account.UserPrincipalName); mailbox.DisplayName = account.DisplayName; return mailbox; } @@ -2571,7 +2574,7 @@ namespace WebsitePanel.EnterpriseServer int exchangeServiceId = GetExchangeServiceID(org.PackageId); ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId); - exchange.SetMailboxPermissions(org.OrganizationId, account.AccountName, sendAsaccounts, fullAccessAcounts); + exchange.SetMailboxPermissions(org.OrganizationId, account.UserPrincipalName, sendAsaccounts, fullAccessAcounts); return 0; @@ -2656,7 +2659,7 @@ namespace WebsitePanel.EnterpriseServer exchange.SetMailboxAdvancedSettings( org.OrganizationId, - account.AccountName, + account.UserPrincipalName, plan.EnablePOP, plan.EnableIMAP, plan.EnableOWA, diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs index 17c5c573..ef2994d8 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs @@ -1336,11 +1336,11 @@ namespace WebsitePanel.EnterpriseServer if (orgProxy.CreateUser(org.OrganizationId, sAMAccountName, displayName, upn, password, enabled) == 0) { - OrganizationUser retUser = orgProxy.GetUserGeneralSettings(upn, org.OrganizationId); + accountName = sAMAccountName; + OrganizationUser retUser = orgProxy.GetUserGeneralSettings(sAMAccountName, org.OrganizationId); TaskManager.Write("sAMAccountName :" + retUser.DomainUserName); - userId = AddOrganizationUser(itemId, upn, displayName, email, retUser.DomainUserName, password, subscriberNumber); - accountName = upn; + userId = AddOrganizationUser(itemId, sAMAccountName, displayName, email, retUser.DomainUserName, password, subscriberNumber); // register email address AddAccountEmailAddress(userId, email); @@ -1432,7 +1432,7 @@ namespace WebsitePanel.EnterpriseServer TaskManager.Write("sAMAccountName :" + retUser.DomainUserName); - userId = AddOrganizationUser(itemId, accountName, displayName, email, retUser.DomainUserName, password, subscriberNumber); + userId = AddOrganizationUser(itemId, retUser.SamAccountName, displayName, email, retUser.DomainUserName, password, subscriberNumber); AddAccountEmailAddress(userId, email); @@ -1461,6 +1461,9 @@ namespace WebsitePanel.EnterpriseServer string CounterStr = "00000"; int counter = 0; bool bFound = false; + + if (!AccountExists(accountName)) return accountName; + do { accountName = genSamLogin(name, CounterStr); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs index 782b59d0..cd7e60b0 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs @@ -371,7 +371,7 @@ namespace WebsitePanel.Providers.HostedSolution userPath = GetUserPath(organizationId, loginName); if (!ActiveDirectoryUtils.AdObjectExists(userPath)) { - userPath = ActiveDirectoryUtils.CreateUser(path, upn, loginName, displayName, password, enabled); + userPath = ActiveDirectoryUtils.CreateUser(path, null, loginName, displayName, password, enabled); DirectoryEntry entry = new DirectoryEntry(userPath); ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.UserPrincipalName, upn); entry.CommitChanges(); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeContactGeneralSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeContactGeneralSettings.ascx index 47c26b55..cd5d026b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeContactGeneralSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeContactGeneralSettings.ascx @@ -78,8 +78,17 @@ + + + + + + +
+ +
- @@ -121,7 +130,7 @@ - @@ -165,7 +174,7 @@ - @@ -204,14 +213,6 @@ - - - - - -
- -
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeContactGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeContactGeneralSettings.ascx.designer.cs index 6186bb22..1868eb35 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeContactGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeContactGeneralSettings.ascx.designer.cs @@ -228,6 +228,24 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::System.Web.UI.WebControls.TextBox txtLastName; + /// + /// locNotes control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locNotes; + + /// + /// txtNotes control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtNotes; + /// /// secCompanyInfo control. /// @@ -570,24 +588,6 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.CountrySelector country; - /// - /// locNotes control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locNotes; - - /// - /// txtNotes control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtNotes; - /// /// btnSave control. /// @@ -605,14 +605,5 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1; - - /// - /// FormComments control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize FormComments; } }