diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 81557fd5..d7d81bcf 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -7119,7 +7119,8 @@ SELECT 'ExchangeAccounts' as ObjectName, AccountID as ObjectID, AccountType as ObjectType, - DisplayName as DisplayName + DisplayName as DisplayName, + 0 as OwnerID FROM ExchangeAccounts WHERE @@ -7128,8 +7129,9 @@ UNION SELECT 'ExchangeAccountEmailAddresses' as ObjectName, eam.AddressID as ObjectID, - eam.AccountID as ObjectType, - eam.EmailAddress as DisplayName + ea.AccountType as ObjectType, + eam.EmailAddress as DisplayName, + eam.AccountID as OwnerID FROM ExchangeAccountEmailAddresses as eam INNER JOIN @@ -7145,7 +7147,8 @@ SELECT 'LyncUsers' as ObjectName, ea.AccountID as ObjectID, ea.AccountType as ObjectType, - ea.DisplayName as DisplayName + ea.DisplayName as DisplayName, + 0 as OwnerID FROM ExchangeAccounts ea INNER JOIN diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCheckDomainName.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCheckDomainName.ascx index 524bd67c..f7f356ef 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCheckDomainName.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCheckDomainName.ascx @@ -32,7 +32,7 @@ + NavigateUrl='<%# GetEditUrl(Eval("ObjectName").ToString(),(int)Eval("ObjectType"),Eval("ObjectID").ToString(),Eval("OwnerID").ToString()) %>'> <%# Eval("DisplayName") %> @@ -48,7 +48,7 @@ + NavigateUrl='<%# GetEditUrl(Eval("ObjectName").ToString(),(int)Eval("ObjectType"),Eval("ObjectID").ToString(),Eval("OwnerID").ToString()) %>'> @@ -59,7 +59,7 @@ 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 c60719bd..9254618e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCheckDomainName.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCheckDomainName.ascx.cs @@ -73,7 +73,22 @@ namespace WebsitePanel.Portal.ExchangeServer public bool AllowDelete(string objectName, int objectType) { - return objectName == EXCHANGEACCOUNTEMAILADDRESSES; + if (objectName == EXCHANGEACCOUNTEMAILADDRESSES) + { + ExchangeAccountType accountType = (ExchangeAccountType)objectType; + switch (accountType) + { + case ExchangeAccountType.Room: + case ExchangeAccountType.Equipment: + case ExchangeAccountType.SharedMailbox: + case ExchangeAccountType.Mailbox: + case ExchangeAccountType.DistributionList: + case ExchangeAccountType.PublicFolder: + return true; + } + + } + return false; } @@ -114,7 +129,7 @@ namespace WebsitePanel.Portal.ExchangeServer return GetThemedImage("Exchange/" + imgName); } - public string GetEditUrl(string objectName, int objectType, string objectId) + public string GetEditUrl(string objectName, int objectType, string objectId, string ownerId) { if (objectName == EXCHANGEACCOUNTS) { @@ -158,10 +173,32 @@ namespace WebsitePanel.Portal.ExchangeServer if (objectName == EXCHANGEACCOUNTEMAILADDRESSES) { - if (objectType>0) - return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "mailbox_addresses", - "AccountID=" + objectType, + string key = ""; + + ExchangeAccountType accountType = (ExchangeAccountType)objectType; + + switch (accountType) + { + case ExchangeAccountType.Mailbox: + case ExchangeAccountType.Room: + case ExchangeAccountType.Equipment: + case ExchangeAccountType.SharedMailbox: + key = "mailbox_addresses"; + break; + case ExchangeAccountType.DistributionList: + key = "dlist_addresses"; + break; + case ExchangeAccountType.PublicFolder: + key = "public_folder_addresses"; + break; + } + + if (!string.IsNullOrEmpty(key)) + { + return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), key, + "AccountID=" + ownerId, "ItemID=" + PanelRequest.ItemID); + } } if (objectName == LYNCUSERS) @@ -196,16 +233,40 @@ namespace WebsitePanel.Portal.ExchangeServer try { string[] arg = e.CommandArgument.ToString().Split(','); - if (arg.Length != 2) return; + if (arg.Length != 3) return; - string[] emails = { arg[1] }; + string[] emails = { arg[2] }; int accountID = 0; if (!int.TryParse(arg[0], out accountID)) return; - int result = ES.Services.ExchangeServer.DeleteMailboxEmailAddresses( - PanelRequest.ItemID, accountID, emails); + int accountTypeID = 0; + if (!int.TryParse(arg[1], out accountTypeID)) + return; + + ExchangeAccountType accountType = (ExchangeAccountType)accountTypeID; + + int result; + + switch(accountType) + { + case ExchangeAccountType.Room: + case ExchangeAccountType.Equipment: + case ExchangeAccountType.SharedMailbox: + case ExchangeAccountType.Mailbox: + result = ES.Services.ExchangeServer.DeleteMailboxEmailAddresses( + PanelRequest.ItemID, accountID, emails); + break; + case ExchangeAccountType.DistributionList: + result = ES.Services.ExchangeServer.DeleteDistributionListEmailAddresses( + PanelRequest.ItemID, accountID, emails); + break; + case ExchangeAccountType.PublicFolder: + result = ES.Services.ExchangeServer.DeletePublicFolderEmailAddresses( + PanelRequest.ItemID, accountID, emails); + break; + } Bind(); }