Exchange2013 fixes
This commit is contained in:
parent
ce508b178c
commit
ee19096e2d
1 changed files with 23 additions and 13 deletions
|
@ -4479,7 +4479,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
{
|
||||
ExchangeLog.LogStart("CheckOrganizationPublicFolderMailbox");
|
||||
|
||||
Collection<PSObject> result = GetPublicFolderMailbox(runSpace, orgCanonicalName, GetPublicFolderMailboxName(organizationId));
|
||||
Collection<PSObject> result = GetPublicFolderMailbox(runSpace, orgCanonicalName, GetPublicFolderMailboxName(organizationId), true);
|
||||
if (result == null || result.Count == 0)
|
||||
{
|
||||
ExchangeTransaction transaction = StartTransaction();
|
||||
|
@ -4501,7 +4501,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
{
|
||||
ExchangeLog.LogStart("CheckOrganizationRootFolder");
|
||||
|
||||
Collection<PSObject> result = GetPublicFolderObject(runSpace, orgCanonicalName+"/"+GetPublicFolderMailboxName(organizationId), "\\" + folder);
|
||||
Collection<PSObject> result = GetPublicFolderObject(runSpace, orgCanonicalName+"/"+GetPublicFolderMailboxName(organizationId), "\\" + folder, true);
|
||||
if (result == null || result.Count == 0)
|
||||
{
|
||||
ExchangeTransaction transaction = StartTransaction();
|
||||
|
@ -4617,22 +4617,22 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
ExchangeLog.LogEnd("DeletePublicFolderInternal");
|
||||
}
|
||||
|
||||
private Collection<PSObject> GetPublicFolderObject(Runspace runSpace, string mailbox, string id)
|
||||
private Collection<PSObject> GetPublicFolderObject(Runspace runSpace, string mailbox, string id, bool checkExist = false)
|
||||
{
|
||||
Command cmd = new Command("Get-PublicFolder");
|
||||
cmd.Parameters.Add("Identity", id);
|
||||
//cmd.Parameters.Add("Mailbox", mailbox);
|
||||
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
|
||||
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd, true, !checkExist);
|
||||
return result;
|
||||
}
|
||||
|
||||
private Collection<PSObject> GetPublicFolderMailbox(Runspace runSpace, string organizationDistinguishedName, string name)
|
||||
private Collection<PSObject> GetPublicFolderMailbox(Runspace runSpace, string organizationDistinguishedName, string name, bool checkExist)
|
||||
{
|
||||
Command cmd = new Command("Get-Mailbox");
|
||||
cmd.Parameters.Add("Identity", name);
|
||||
cmd.Parameters.Add("PublicFolder");
|
||||
cmd.Parameters.Add("OrganizationalUnit", organizationDistinguishedName);
|
||||
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
|
||||
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd, true, !checkExist);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -5369,7 +5369,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
string resultObjectDN = null;
|
||||
Command cmd = new Command("Get-AddressList");
|
||||
cmd.Parameters.Add("Identity", id);
|
||||
Collection<PSObject> result = this.ExecuteShellCommand(runSpace, cmd);
|
||||
Collection<PSObject> result = this.ExecuteShellCommand(runSpace, cmd, true, false);
|
||||
if ((result != null) && (result.Count > 0))
|
||||
{
|
||||
resultObjectDN = this.GetResultObjectDN(result);
|
||||
|
@ -6242,13 +6242,19 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
|
||||
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd)
|
||||
{
|
||||
return ExecuteShellCommand(runSpace, cmd, true);
|
||||
return ExecuteShellCommand(runSpace, cmd, true, true);
|
||||
}
|
||||
|
||||
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController)
|
||||
{
|
||||
object[] errors;
|
||||
return ExecuteShellCommand(runSpace, cmd, useDomainController, out errors);
|
||||
return ExecuteShellCommand(runSpace, cmd, useDomainController, out errors, true);
|
||||
}
|
||||
|
||||
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController, bool writeErrorExchangeLog)
|
||||
{
|
||||
object[] errors;
|
||||
return ExecuteShellCommand(runSpace, cmd, useDomainController, out errors, writeErrorExchangeLog);
|
||||
}
|
||||
|
||||
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, ResultObject res)
|
||||
|
@ -6272,10 +6278,10 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
|
||||
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, out object[] errors)
|
||||
{
|
||||
return ExecuteShellCommand(runSpace, cmd, true, out errors);
|
||||
return ExecuteShellCommand(runSpace, cmd, true, out errors, true);
|
||||
}
|
||||
|
||||
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController, out object[] errors)
|
||||
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController, out object[] errors, bool writeErrorExchangeLog)
|
||||
{
|
||||
ExchangeLog.LogStart("ExecuteShellCommand");
|
||||
List<object> errorList = new List<object>();
|
||||
|
@ -6309,8 +6315,12 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
foreach (object item in pipeLine.Error.ReadToEnd())
|
||||
{
|
||||
errorList.Add(item);
|
||||
string errorMessage = string.Format("Invoke error: {0}", item);
|
||||
ExchangeLog.LogWarning(errorMessage);
|
||||
|
||||
if (writeErrorExchangeLog)
|
||||
{
|
||||
string errorMessage = string.Format("Invoke error: {0}", item);
|
||||
ExchangeLog.LogWarning(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue