diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql
index 37f9c432..48b8c08d 100644
--- a/WebsitePanel/Database/update_db.sql
+++ b/WebsitePanel/Database/update_db.sql
@@ -7121,13 +7121,19 @@ WHERE
UNION
SELECT
'ExchangeAccountEmailAddresses' as ObjectName,
- AddressID as ObjectID,
- AccountID as ObjectType,
- EmailAddress as DisplayName
+ eam.AddressID as ObjectID,
+ eam.AccountID as ObjectType,
+ eam.EmailAddress as DisplayName
FROM
- ExchangeAccountEmailAddresses
+ ExchangeAccountEmailAddresses as eam
+INNER JOIN
+ ExchangeAccounts ea
+ON
+ ea.AccountID = eam.AccountID
WHERE
- EmailAddress LIKE '%@'+ @DomainName
+ (ea.PrimaryEmailAddress != eam.EmailAddress)
+ AND (ea.UserPrincipalName != eam.EmailAddress)
+ AND (eam.EmailAddress LIKE '%@'+ @DomainName)
UNION
SELECT
'LyncUsers' as ObjectName,
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config
index 5e7e4ae7..343ad2ee 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config
@@ -64,6 +64,7 @@
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeCheckDomainName.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeCheckDomainName.ascx.resx
index 58d2bd89..61f40c55 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeCheckDomainName.ascx.resx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/ExchangeCheckDomainName.ascx.resx
@@ -118,10 +118,10 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- Delete domain
+ Domain Dependencies
- Delete domain
+ Domain Dependencies
Display Name
@@ -177,4 +177,7 @@
Organization user
+
+ Lync User
+
\ No newline at end of file
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCheckDomainName.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCheckDomainName.ascx.cs
index a612a7b1..c60719bd 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCheckDomainName.ascx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCheckDomainName.ascx.cs
@@ -44,7 +44,8 @@ namespace WebsitePanel.Portal.ExchangeServer
if (!IsPostBack)
{
// save return URL
- ViewState["ReturnUrl"] = Request.UrlReferrer.ToString();
+ if (Request.UrlReferrer!=null)
+ ViewState["ReturnUrl"] = Request.UrlReferrer.ToString();
// domain name
DomainInfo domain = ES.Services.Servers.GetDomain(PanelRequest.DomainID);