Partial fixed on exchange 2013 litigation hold

This commit is contained in:
robvde 2013-02-02 16:03:23 +04:00
parent b7ab52690e
commit f924299d3e
2 changed files with 60 additions and 9 deletions

View file

@ -5,11 +5,11 @@
</configSections>
<!-- Connection strings -->
<connectionStrings>
<add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=sa;pwd=Password12" providerName="System.Data.SqlClient" />
<add name="EnterpriseServer" connectionString="server=2012PROV01;database=WebsitePanel;uid=WebsitePanel;pwd=5qc7ftf6q42byc08z857;Connection Timeout=60;" />
</connectionStrings>
<appSettings>
<!-- Encryption util settings -->
<add key="WebsitePanel.CryptoKey" value="1234567890" />
<add key="WebsitePanel.CryptoKey" value="fbd61z4gwsc2m01x7xn2" />
<!-- A1D4KDHUE83NKHddF -->
<add key="WebsitePanel.EncryptionEnabled" value="true" />
<!-- Web Applications -->
@ -21,6 +21,7 @@
<!-- Alternative connection string, pulls the value from registry -->
<add key="WebsitePanel.AltConnectionString" value="ConnectionString" />
<add key="WebsitePanel.AltCryptoKey" value="CryptoKey" />
<add key="WebsitePanel.DistableScheduler" value="false" />
</appSettings>
<system.web>
<!-- Disable any authentication -->

View file

@ -1934,13 +1934,22 @@ namespace WebsitePanel.Providers.HostedSolution
if (enabledLitigationHold)
{
cmd.Parameters.Add("LitigationHoldEnabled", true);
cmd.Parameters.Add("RecoverableItemsQuota", ConvertKBToUnlimited(recoverabelItemsSpace));
cmd.Parameters.Add("RecoverableItemsWarningQuota", ConvertKBToUnlimited(recoverabelItemsWarning));
}
ExecuteShellCommand(runSpace, cmd);
//Litigation Hold
if (enabledLitigationHold)
{
cmd = new Command("New-MailboxSearch");
cmd.Parameters.Add("Name", upn);
cmd.Parameters.Add("InPlaceHoldEnabled", enabledLitigationHold);
cmd.Parameters.Add("SourceMailboxes", upn);
ExecuteShellCommand(runSpace, cmd);
}
//Client Access
cmd = new Command("Set-CASMailbox");
cmd.Parameters.Add("Identity", id);
@ -2267,7 +2276,7 @@ namespace WebsitePanel.Providers.HostedSolution
info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName");
info.HideFromAddressBook = (bool)GetPSObjectProperty(mailbox, "HiddenFromAddressListsEnabled");
info.EnableLitigationHold = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled");
Command cmd = new Command("Get-User");
cmd.Parameters.Add("Identity", accountName);
@ -2298,6 +2307,18 @@ namespace WebsitePanel.Providers.HostedSolution
info.WebPage = (string)GetPSObjectProperty(user, "WebPage");
info.Notes = (string)GetPSObjectProperty(user, "Notes");
//Litigation Hold
info.EnableLitigationHold = false;
cmd = new Command("Get-MailboxSearch");
cmd.Parameters.Add("Identity", accountName);
result = ExecuteShellCommand(runSpace, cmd);
if ((result != null) & (result.Count > 0))
{
mailbox = result[0];
info.EnableLitigationHold = (bool)GetPSObjectProperty(mailbox, "InPlaceHoldEnabled");
}
}
finally
{
@ -2478,8 +2499,6 @@ namespace WebsitePanel.Providers.HostedSolution
info.KeepDeletedItemsDays =
ConvertEnhancedTimeSpanToDays((EnhancedTimeSpan)GetPSObjectProperty(mailbox, "RetainDeletedItemsFor"));
info.EnableLitigationHold = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled");
info.RecoverabelItemsSpace =
ConvertUnlimitedToKB((Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "RecoverableItemsQuota"));
info.RecoverabelItemsWarning =
@ -2497,6 +2516,18 @@ namespace WebsitePanel.Providers.HostedSolution
info.EnablePOP = (bool)GetPSObjectProperty(mailbox, "PopEnabled");
info.EnableIMAP = (bool)GetPSObjectProperty(mailbox, "ImapEnabled");
//Litigation Hold
info.EnableLitigationHold = false;
cmd = new Command("Get-MailboxSearch");
cmd.Parameters.Add("Identity", accountName);
result = ExecuteShellCommand(runSpace, cmd);
if ((result != null) & (result.Count > 0))
{
mailbox = result[0];
info.EnableLitigationHold = (bool)GetPSObjectProperty(mailbox, "InPlaceHoldEnabled");
}
//Statistics
cmd = new Command("Get-MailboxStatistics");
cmd.Parameters.Add("Identity", accountName);
@ -2558,9 +2589,7 @@ namespace WebsitePanel.Providers.HostedSolution
cmd.Parameters.Add("MaxSendSize", ConvertKBToUnlimited(maxSendMessageSizeKB));
cmd.Parameters.Add("MaxReceiveSize", ConvertKBToUnlimited(maxReceiveMessageSizeKB));
cmd.Parameters.Add("LitigationHoldEnabled", enabledLitigationHold);
cmd.Parameters.Add("RecoverableItemsQuota", ConvertKBToUnlimited(recoverabelItemsSpace));
cmd.Parameters.Add("RetentionUrl", litigationHoldUrl);
cmd.Parameters.Add("RetentionComment", litigationHoldMsg);
@ -2568,6 +2597,16 @@ namespace WebsitePanel.Providers.HostedSolution
ExecuteShellCommand(runSpace, cmd);
//LitigationHold
cmd = new Command("Get-MailboxSearch");
cmd.Parameters.Add("Identity", accountName);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
cmd = new Command((result == null) || (result.Count == 0) ? "New-MailboxSearch" : "Set-MailboxSearch");
cmd.Parameters.Add((result == null) || (result.Count == 0) ? "Name" : "Identity", accountName);
cmd.Parameters.Add("InPlaceHoldEnabled", enabledLitigationHold);
cmd.Parameters.Add("SourceMailboxes", accountName);
ExecuteShellCommand(runSpace, cmd);
//Client Access
cmd = new Command("Set-CASMailbox");
cmd.Parameters.Add("Identity", accountName);
@ -2943,7 +2982,6 @@ namespace WebsitePanel.Providers.HostedSolution
string path = AddADPrefix(dn);
DirectoryEntry entry = GetADObject(path);
info.Enabled = !(bool)entry.InvokeGet("AccountDisabled");
info.LitigationHoldEnabled = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled");
info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName");
SmtpAddress smtpAddress = (SmtpAddress)GetPSObjectProperty(mailbox, "PrimarySmtpAddress");
@ -2953,6 +2991,7 @@ namespace WebsitePanel.Providers.HostedSolution
info.MaxSize = ConvertUnlimitedToBytes((Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "ProhibitSendReceiveQuota"));
DateTime? whenCreated = (DateTime?)GetPSObjectProperty(mailbox, "WhenCreated");
info.AccountCreated = ConvertNullableToDateTime(whenCreated);
//Client Access
Command cmd = new Command("Get-CASMailbox");
cmd.Parameters.Add("Identity", id);
@ -2965,6 +3004,17 @@ namespace WebsitePanel.Providers.HostedSolution
info.POPEnabled = (bool)GetPSObjectProperty(mailbox, "PopEnabled");
info.IMAPEnabled = (bool)GetPSObjectProperty(mailbox, "ImapEnabled");
//Litigation Hold
info.LitigationHoldEnabled = false;
cmd = new Command("Get-MailboxSearch");
cmd.Parameters.Add("Identity", id);
result = ExecuteShellCommand(runSpace, cmd);
if ((result != null) & (result.Count > 0))
{
mailbox = result[0];
info.LitigationHoldEnabled = (bool)GetPSObjectProperty(mailbox, "InPlaceHoldEnabled");
}
//Statistics
cmd = new Command("Get-MailboxStatistics");
cmd.Parameters.Add("Identity", id);