new tool FixDefaultPublicFolderMailbox
This commit is contained in:
parent
d00cb1bb01
commit
9a18300889
13 changed files with 949 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// Copyright (c) 2014, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
@ -5380,6 +5380,61 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return res;
|
||||
}
|
||||
|
||||
public static string SetDefaultPublicFolderMailbox(int itemId)
|
||||
{
|
||||
string res = "";
|
||||
|
||||
try
|
||||
{
|
||||
Organization org = GetOrganization(itemId);
|
||||
if (org == null)
|
||||
return null;
|
||||
|
||||
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
|
||||
|
||||
if (exchangeServiceId <= 0)
|
||||
return null;
|
||||
|
||||
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
|
||||
|
||||
if (exchange == null)
|
||||
return null;
|
||||
|
||||
//Create Exchange Organization
|
||||
if (string.IsNullOrEmpty(org.GlobalAddressList))
|
||||
{
|
||||
ExtendToExchangeOrganization(ref org);
|
||||
|
||||
PackageController.UpdatePackageItem(org);
|
||||
}
|
||||
|
||||
res += "OrgPublicFolderMailbox = " + exchange.CreateOrganizationRootPublicFolder(org.OrganizationId, org.DistinguishedName, org.SecurityGroup, org.DefaultDomain) + Environment.NewLine;
|
||||
|
||||
List<ExchangeAccount> mailboxes = GetExchangeMailboxes(itemId);
|
||||
|
||||
foreach(ExchangeAccount mailbox in mailboxes)
|
||||
{
|
||||
string id = mailbox.PrimaryEmailAddress;
|
||||
string[] defaultPublicFoldes = exchange.SetDefaultPublicFolderMailbox(id, org.OrganizationId, org.DistinguishedName);
|
||||
|
||||
if (defaultPublicFoldes.Length==1)
|
||||
res += id + " has a value \"" + defaultPublicFoldes[0] + "\"" + Environment.NewLine;
|
||||
|
||||
if (defaultPublicFoldes.Length == 2)
|
||||
res += id + " changed from \"" + defaultPublicFoldes[0] + "\" to \"" + defaultPublicFoldes[1] + "\"" + Environment.NewLine;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
res += " Error " + ex.ToString();
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Helpers
|
||||
|
@ -5873,5 +5928,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue