wsp-10200 Domain remains in "Accepted domains" in Exchange 2010/13 environment
after deletion hosted organization/space from WSP Fixed
This commit is contained in:
parent
24ad3c2c25
commit
4bcfe5f5cf
15 changed files with 2777 additions and 3432 deletions
|
@ -196,10 +196,10 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
|
||||
public bool DeleteOrganization(string organizationId, string distinguishedName,
|
||||
string globalAddressList, string addressList, string roomList, string offlineAddressBook,
|
||||
string securityGroup, string addressBookPolicy)
|
||||
string securityGroup, string addressBookPolicy, List<ExchangeDomainName> acceptedDomains)
|
||||
{
|
||||
return DeleteOrganizationInternal(organizationId, distinguishedName, globalAddressList,
|
||||
addressList, roomList, offlineAddressBook, securityGroup, addressBookPolicy);
|
||||
addressList, roomList, offlineAddressBook, securityGroup, addressBookPolicy, acceptedDomains);
|
||||
}
|
||||
|
||||
public void SetOrganizationStorageLimits(string organizationDistinguishedName, long issueWarningKB, long prohibitSendKB,
|
||||
|
@ -616,11 +616,11 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
{
|
||||
Organization org = item as Organization;
|
||||
DeleteOrganization(org.OrganizationId, org.DistinguishedName, org.GlobalAddressList,
|
||||
org.AddressList, org.RoomsAddressList, org.OfflineAddressBook, org.SecurityGroup, org.AddressBookPolicy);
|
||||
org.AddressList, org.RoomsAddressList, org.OfflineAddressBook, org.SecurityGroup, org.AddressBookPolicy, null);
|
||||
}
|
||||
else if (item is ExchangeDomain)
|
||||
{
|
||||
DeleteAcceptedDomain(item.Name);
|
||||
DeleteAcceptedDomain(null, item.Name);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -902,7 +902,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
|
||||
|
||||
internal virtual bool DeleteOrganizationInternal(string organizationId, string distinguishedName,
|
||||
string globalAddressList, string addressList, string roomsAddressList, string offlineAddressBook, string securityGroup, string addressBookPolicy)
|
||||
string globalAddressList, string addressList, string roomsAddressList, string offlineAddressBook, string securityGroup, string addressBookPolicy, List<ExchangeDomainName> acceptedDomains)
|
||||
{
|
||||
ExchangeLog.LogStart("DeleteOrganizationInternal");
|
||||
bool ret = true;
|
||||
|
@ -1005,6 +1005,9 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
ret = false;
|
||||
ExchangeLog.LogError("Could not disable mail security distribution group " + securityGroup, ex);
|
||||
}
|
||||
|
||||
if (!DeleteOrganizationAcceptedDomains(runSpace, acceptedDomains))
|
||||
ret = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -1181,6 +1184,33 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
internal bool DeleteOrganizationAcceptedDomains(Runspace runSpace, List<ExchangeDomainName> acceptedDomains)
|
||||
{
|
||||
ExchangeLog.LogStart("DeleteOrganizationAcceptedDomains");
|
||||
|
||||
bool ret = true;
|
||||
|
||||
if (acceptedDomains != null)
|
||||
{
|
||||
|
||||
foreach (ExchangeDomainName domain in acceptedDomains)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeleteAcceptedDomain(runSpace, domain.DomainName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExchangeLog.LogError(string.Format("Failed to delete accepted domain {0}", domain), ex);
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
ExchangeLog.LogEnd("DeleteOrganizationAcceptedDomains");
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void SetOrganizationStorageLimitsInternal(string organizationDistinguishedName, long issueWarningKB,
|
||||
long prohibitSendKB, long prohibitSendReceiveKB, int keepDeletedItemsDays)
|
||||
{
|
||||
|
@ -6000,14 +6030,19 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
ExchangeLog.LogEnd("ChangeAcceptedDomainType");
|
||||
}
|
||||
|
||||
private void DeleteAcceptedDomain(string domainName)
|
||||
private void DeleteAcceptedDomain(Runspace runSpace, string domainName)
|
||||
{
|
||||
ExchangeLog.LogStart("DeleteAcceptedDomain");
|
||||
|
||||
Runspace runSpace = null;
|
||||
bool bCloseRunSpace = false;
|
||||
|
||||
try
|
||||
{
|
||||
runSpace = OpenRunspace();
|
||||
if (runSpace == null)
|
||||
{
|
||||
bCloseRunSpace = true;
|
||||
runSpace = OpenRunspace();
|
||||
}
|
||||
|
||||
RemoveAcceptedDomain(runSpace, domainName);
|
||||
}
|
||||
|
@ -6019,7 +6054,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
finally
|
||||
{
|
||||
|
||||
CloseRunspace(runSpace);
|
||||
if (bCloseRunSpace) CloseRunspace(runSpace);
|
||||
}
|
||||
|
||||
ExchangeLog.LogEnd("DeleteAcceptedDomain");
|
||||
|
@ -6033,7 +6068,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
{
|
||||
ExchangeLog.LogStart("DeleteDomainInternal");
|
||||
//Delete accepted domain
|
||||
DeleteAcceptedDomain(domain);
|
||||
DeleteAcceptedDomain(null, domain);
|
||||
ExchangeLog.LogEnd("DeleteDomainInternal");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue