Fixed: Error when calculating diskspace and no public folder database available

This commit is contained in:
robvde 2012-09-18 22:50:44 +04:00
parent 6868241a6d
commit 68fa24ff35

View file

@ -1374,11 +1374,15 @@ namespace WebsitePanel.Providers.HostedSolution
long size = 0;
Command cmd = new Command("Get-PublicFolderStatistics");
Command cmd = new Command("Get-PublicFolderDatabase");
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
if (result != null && result.Count > 0)
{
cmd = new Command("Get-PublicFolderStatistics");
cmd.Parameters.Add("Identity", folder);
if (!string.IsNullOrEmpty(PublicFolderServer))
cmd.Parameters.Add("Server", PublicFolderServer);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
result = ExecuteShellCommand(runSpace, cmd);
if (result != null && result.Count > 0)
{
PSObject obj = result[0];
@ -1398,6 +1402,9 @@ namespace WebsitePanel.Providers.HostedSolution
string id = ObjToString(GetPSObjectProperty(obj, "Identity"));
size += CalculatePublicFolderDiskSpace(runSpace, id);
}
}
else
size = 0;
ExchangeLog.LogEnd("CalculatePublicFolderDiskSpace");
return size;
}