diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index c6c2da1a..d9317121 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -8562,3 +8562,38 @@ RETURN GO + +IF OBJECTPROPERTY(object_id('dbo.GetExchangeAccountByAccountNameWithoutItemId'), N'IsProcedure') = 1 +DROP PROCEDURE [dbo].[GetExchangeAccountByAccountNameWithoutItemId] +GO +CREATE PROCEDURE [dbo].[GetExchangeAccountByAccountNameWithoutItemId] +( + @UserPrincipalName nvarchar(300) +) +AS +SELECT + E.AccountID, + E.ItemID, + E.AccountType, + E.AccountName, + E.DisplayName, + E.PrimaryEmailAddress, + E.MailEnabledPublicFolder, + E.MailboxManagerActions, + E.SamAccountName, + E.AccountPassword, + E.MailboxPlanId, + P.MailboxPlan, + E.SubscriberNumber, + E.UserPrincipalName, + E.ArchivingMailboxPlanId, + AP.MailboxPlan as 'ArchivingMailboxPlan', + E.EnableArchiving +FROM + ExchangeAccounts AS E +LEFT OUTER JOIN ExchangeMailboxPlans AS P ON E.MailboxPlanId = P.MailboxPlanId +LEFT OUTER JOIN ExchangeMailboxPlans AS AP ON E.ArchivingMailboxPlanId = AP.MailboxPlanId +WHERE + E.UserPrincipalName = @UserPrincipalName +RETURN +GO \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs index 86a2de49..1ef34bd0 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs @@ -2684,13 +2684,13 @@ namespace WebsitePanel.EnterpriseServer ); } - public static IDataReader GetExchangeAccountByAccountNameWithoutItemId(string primaryEmailAddress) + public static IDataReader GetExchangeAccountByAccountNameWithoutItemId(string userPrincipalName) { return SqlHelper.ExecuteReader( ConnectionString, CommandType.StoredProcedure, "GetExchangeAccountByAccountNameWithoutItemId", - new SqlParameter("@PrimaryEmailAddress", primaryEmailAddress) + new SqlParameter("@UserPrincipalName", userPrincipalName) ); } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs index f8698cf5..5f6a2acf 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs @@ -1217,10 +1217,10 @@ namespace WebsitePanel.EnterpriseServer return account; } - public static ExchangeAccount GetAccountByAccountName(string primaryEmailAddress) + public static ExchangeAccount GetAccountByAccountName(string userPrincipalName) { ExchangeAccount account = ObjectUtils.FillObjectFromDataReader( - DataProvider.GetExchangeAccountByAccountNameWithoutItemId(primaryEmailAddress)); + DataProvider.GetExchangeAccountByAccountNameWithoutItemId(userPrincipalName)); if (account == null) return null;