Пример #1
0
 public static void TargetAllMDBsPostAction(DataRow input, DataTable dataTable, DataObjectStore store)
 {
     store.SetModifiedColumns(new List <string>
     {
         "TargetAllMDBs"
     });
 }
Пример #2
0
        public static void PreGetObjectAction(DataRow inputrow, DataTable dataTable, DataObjectStore store)
        {
            string text = string.Empty;

            if (inputrow["Identity"] is Identity)
            {
                Identity identity = (Identity)inputrow["Identity"];
                text = identity.RawIdentity;
            }
            else
            {
                text = (string)inputrow["Identity"];
            }
            string[] array = text.Split(new char[]
            {
                ' '
            });
            inputrow["MessageTraceId"]   = array[0];
            inputrow["RecipientAddress"] = array[1];
            store.SetModifiedColumns(new List <string>(new string[]
            {
                "MessageTraceId",
                "RecipientAddress"
            }));
        }
        public static void GetDomainOptions(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            List <string> cloudDomainNames = null;
            string        text             = inputRow["CloudDomains"] as string;

            if (text != null)
            {
                cloudDomainNames = (from cloudDomain in text.Split(new char[]
                {
                    ','
                })
                                    select cloudDomain.Trim()).ToList <string>();
            }
            IEnumerable <object> source     = store.GetDataObject("AcceptedDomain") as IEnumerable <object>;
            IEnumerable <object> enumerable = from domain in source
                                              where HybridConfigurationWizardServiceCodeBehind.IsSelectableDomain((Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain)domain, cloudDomainNames)
                                              select((Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain)domain).DomainName.SmtpDomain;
            int num = enumerable.Count <object>();

            if (num != 0)
            {
                inputRow["DomainOptions"] = (dataTable.Rows[0]["DomainOptions"] = enumerable);
            }
            if (num == 1)
            {
                store.SetModifiedColumns(new List <string>
                {
                    "Domains"
                });
                inputRow["Domains"] = (dataTable.Rows[0]["Domains"] = enumerable.First <object>().ToString());
            }
        }
Пример #4
0
        public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow       dataRow = dataTable.Rows[0];
            List <string> list    = new List <string>();

            MailboxPropertiesHelper.SaveQuotaProperty(dataRow, null, "IssueWarningQuota", list);
            MailboxPropertiesHelper.SaveQuotaProperty(dataRow, null, "ProhibitSendQuota", list);
            MailboxPropertiesHelper.SaveQuotaProperty(dataRow, null, "ProhibitSendReceiveQuota", list);
            if (DBNull.Value != dataRow["DeletedItemRetention"])
            {
                dataRow["DeletedItemRetention"] = EnhancedTimeSpan.Parse((string)dataRow["DeletedItemRetention"]);
                list.Add("DeletedItemRetention");
            }
            if (DBNull.Value != dataRow["MailboxRetention"])
            {
                dataRow["MailboxRetention"] = EnhancedTimeSpan.Parse((string)dataRow["MailboxRetention"]);
                list.Add("MailboxRetention");
            }
            DatabasePropertiesHelper.SetScheduleProperty(dataRow, "MaintenanceSchedule", list);
            DatabasePropertiesHelper.SetScheduleProperty(dataRow, "QuotaNotificationSchedule", list);
            if (list.Count != 0)
            {
                store.SetModifiedColumns(list);
            }
        }
        public static void GenerateName(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            ReducedRecipient reducedRecipient = store.GetDataObject("ReducedRecipient") as ReducedRecipient;
            string           text             = (string)inputRow["DisplayName"];

            if (reducedRecipient != null)
            {
                string text2 = " " + Guid.NewGuid().ToString("B").ToUpperInvariant();
                if (text.Length > 64)
                {
                    text = text.SurrogateSubstring(0, text.Length - text2.Length);
                }
                inputRow["Name"] = text + text2;
            }
            else
            {
                if (text.Length > 64)
                {
                    text = text.SurrogateSubstring(0, 64);
                }
                inputRow["Name"] = text;
            }
            store.SetModifiedColumns(new List <string>
            {
                "Name"
            });
        }
Пример #6
0
        public static void SetOutboundSpamFilterPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow       row             = dataTable.Rows[0];
            List <string> modifiedColumns = new List <string>();

            Antispam.outboundEmailListParameters.ForEach(delegate(string p)
            {
                string text = string.Format("str{0}", p);
                if (!DBNull.Value.Equals(row[text]))
                {
                    string[] array = row[text].ToString().Split(new char[]
                    {
                        ';'
                    }, StringSplitOptions.RemoveEmptyEntries);
                    MultiValuedProperty <SmtpAddress> multiValuedProperty = new MultiValuedProperty <SmtpAddress>();
                    foreach (string text2 in array)
                    {
                        multiValuedProperty.Add(new SmtpAddress(text2.Trim()));
                    }
                    inputRow[text] = multiValuedProperty;
                    modifiedColumns.Add(text);
                }
            });
            if (modifiedColumns.Count > 0)
            {
                store.SetModifiedColumns(modifiedColumns);
            }
        }
Пример #7
0
        public static void IdentityToStringAction(DataRow inputrow, DataTable dataTable, DataObjectStore store)
        {
            List <string> list     = new List <string>();
            Identity      identity = inputrow["Identity"] as Identity;

            inputrow["Identity"] = identity.RawIdentity.Replace(" ", "+");
            list.Add("Identity");
            store.SetModifiedColumns(list);
        }
Пример #8
0
 public static void GetServerListPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
 {
     inputRow["MaxMajorVersion"] = "15";
     inputRow["MinMajorVersion"] = "15";
     inputRow["ServerRole"]      = ServerRole.ClientAccess.ToString() + "," + ServerRole.Mailbox.ToString();
     store.SetModifiedColumns(new List <string>
     {
         "MaxMajorVersion",
         "MinMajorVersion",
         "ServerRole"
     });
     ServerProperties.GetListPostAction(inputRow, dataTable, store);
 }
        public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow       dataRow = dataTable.Rows[0];
            List <string> list    = new List <string>();

            PublicFolderMailboxService.SaveQuotaProperty(dataRow, "UseDatabaseQuotaDefaults", "IssueWarningQuota", list);
            PublicFolderMailboxService.SaveQuotaProperty(dataRow, "UseDatabaseQuotaDefaults", "ProhibitSendReceiveQuota", list);
            Unlimited <ByteQuantifiedSize> unlimited = Unlimited <ByteQuantifiedSize> .UnlimitedValue;

            if (!DBNull.Value.Equals(dataRow["MaxReceiveSize"]))
            {
                list.Add("MaxReceiveSize");
                unlimited = Unlimited <ByteQuantifiedSize> .Parse((string)dataRow["MaxReceiveSize"]);

                store.SetModifiedColumns(list);
            }
            inputRow["MaxReceiveSize"] = unlimited;
            dataRow["MaxReceiveSize"]  = unlimited;
            if (list.Count != 0)
            {
                store.SetModifiedColumns(list);
            }
        }
Пример #10
0
 public static void GetListPreAction(DataRow input, DataTable dataTable, DataObjectStore store)
 {
     if (input["UserName"] != DBNull.Value && input["Password"] != DBNull.Value)
     {
         List <string> list = new List <string>();
         string        text = (string)input["UserName"];
         if (!string.IsNullOrEmpty(text))
         {
             input["Credential"] = text.ToPSCredential((SecureString)input["Password"]);
             list.Add("Credential");
             store.SetModifiedColumns(list);
         }
     }
 }
Пример #11
0
        public static void NewObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow       dataRow = dataTable.Rows[0];
            List <string> list    = new List <string>();

            if (!dataRow["SearchAllMailboxes"].IsNullValue() && dataRow["SearchAllMailboxes"].IsTrue())
            {
                dataRow["SourceMailboxes"]    = null;
                dataRow["AllSourceMailboxes"] = true;
            }
            if (!dataRow["SearchAllPublicFolders"].IsNullValue() && dataRow["SearchAllPublicFolders"].IsTrue())
            {
                dataRow["PublicFolderSources"]    = null;
                dataRow["AllPublicFolderSources"] = true;
            }
            if (!dataRow["HoldIndefinitely"].IsNullValue() && dataRow["HoldIndefinitely"].IsTrue())
            {
                dataRow["ItemHoldPeriod"] = Unlimited <EnhancedTimeSpan> .UnlimitedValue;
                list.Add("ItemHoldPeriod");
            }
            if (!dataRow["SearchContent"].IsNullValue())
            {
                bool flag = (bool)dataRow["SearchContent"];
                if (flag)
                {
                    if (!string.IsNullOrEmpty((string)dataRow["SenderList"]))
                    {
                        dataRow["Senders"] = ((string)dataRow["SenderList"]).ToArrayOfStrings();
                        list.Add("Senders");
                    }
                    if (!string.IsNullOrEmpty((string)dataRow["RecipientList"]))
                    {
                        dataRow["Recipients"] = ((string)dataRow["RecipientList"]).ToArrayOfStrings();
                        list.Add("Recipients");
                    }
                    if (!string.IsNullOrEmpty((string)dataRow["MessageTypeList"]))
                    {
                        dataRow["MessageTypes"] = ((string)dataRow["MessageTypeList"]).ToArrayOfStrings();
                        list.Add("MessageTypes");
                    }
                }
            }
            store.SetModifiedColumns(list);
        }
Пример #12
0
        public static void PreGetObjectAction(DataRow inputrow, DataTable dataTable, DataObjectStore store)
        {
            AuditLogIdentity auditLogIdentity = new AuditLogIdentity((Identity)inputrow["Identity"]);

            inputrow["StartDate"] = auditLogIdentity.StartDate;
            inputrow["EndDate"]   = auditLogIdentity.EndDate;
            inputrow["Cmdlets"]   = auditLogIdentity.Cmdlet;
            inputrow["ObjectIds"] = auditLogIdentity.ObjectId;
            store.SetModifiedColumns(new List <string>(new string[]
            {
                "StartDate",
                "EndDate",
                "Cmdlets",
                "ObjectIds"
            }));
        }
Пример #13
0
        public static void PreGetListAction(DataRow inputrow, DataTable dataTable, DataObjectStore store)
        {
            List <string> list = new List <string>();

            if (inputrow["StartDate"] != DBNull.Value)
            {
                inputrow["StartDate"] = AuditHelper.GetDateForAuditReportsFilter((string)inputrow["StartDate"], false);
                list.Add("StartDate");
            }
            if (inputrow["EndDate"] != DBNull.Value)
            {
                inputrow["EndDate"] = AuditHelper.GetDateForAuditReportsFilter((string)inputrow["EndDate"], true);
                list.Add("EndDate");
            }
            store.SetModifiedColumns(list);
        }
Пример #14
0
        public static void GetFirstObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow dataRow = dataTable.Rows[0];

            if (dataRow["Identity"] is IEnumerable <Identity> )
            {
                inputRow["FirstDatabase"] = ((Identity[])dataRow["Identity"])[0];
            }
            else
            {
                inputRow["FirstDatabase"] = dataRow["Identity"];
            }
            store.SetModifiedColumns(new List <string>
            {
                "FirstDatabase"
            });
        }
Пример #15
0
        public static void OnPreAddDatabaseCopy(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow dataRow = dataTable.Rows[0];

            if (!DBNull.Value.Equals(dataRow["ReplayLagTime"]) && !DDIHelper.IsEmptyValue(dataRow["ReplayLagTime"]))
            {
                inputRow["ReplayLagTime"] = ((string)dataRow["ReplayLagTime"]).FromTimeSpan(TimeUnit.Day);
            }
            else
            {
                inputRow["ReplayLagTime"] = "0".FromTimeSpan(TimeUnit.Day);
            }
            store.SetModifiedColumns(new List <string>
            {
                "ReplayLagTime"
            });
        }
Пример #16
0
        public static void SetObjectForCopySearchPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow       dataRow = dataTable.Rows[0];
            List <string> list    = new List <string>();

            dataRow["EstimateOnly"] = false;
            list.Add("EstimateOnly");
            if (!dataRow["EnableFullLogging"].IsNullValue())
            {
                if (dataRow["EnableFullLogging"].IsTrue())
                {
                    dataRow["LogLevel"] = LoggingLevel.Full;
                }
                else
                {
                    dataRow["LogLevel"] = LoggingLevel.Basic;
                }
                list.Add("LogLevel");
            }
            if (!dataRow["LogLevel"].IsNullValue() && (LoggingLevel)dataRow["LogLevel"] == LoggingLevel.Suppress)
            {
                dataRow["LogLevel"] = LoggingLevel.Basic;
                list.Add("LogLevel");
            }
            if (!dataRow["SendMeEmailOnComplete"].IsNullValue())
            {
                if (dataRow["SendMeEmailOnComplete"].IsTrue())
                {
                    dataRow["StatusMailRecipients"] = RbacPrincipal.Current.ExecutingUserId;
                }
                else
                {
                    dataRow["StatusMailRecipients"] = null;
                }
                list.Add("StatusMailRecipients");
            }
            store.SetModifiedColumns(list);
        }
Пример #17
0
        public static void PostGetObjectAction(DataRow inputrow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow dataRow;

            if (dataTable.Rows.Count > 1)
            {
                AuditLogIdentity changeId = new AuditLogIdentity((Identity)inputrow["Identity"]);
                List <DataRow>   list     = new List <DataRow>();
                foreach (object obj in dataTable.Rows)
                {
                    DataRow item = (DataRow)obj;
                    list.Add(item);
                }
                dataRow = list.FirstOrDefault((DataRow r) => AuditingLog.GetDetailRow(r, changeId));
                Array.ForEach <DataRow>(list.Except(new DataRow[]
                {
                    dataRow
                }).ToArray <DataRow>(), delegate(DataRow r)
                {
                    dataTable.Rows.Remove(r);
                });
            }
            else
            {
                dataRow = dataTable.Rows[0];
            }
            if (DBNull.Value != dataRow["CmdletParameters"])
            {
                MultiValuedProperty <AdminAuditLogCmdletParameter> source = (MultiValuedProperty <AdminAuditLogCmdletParameter>)dataRow["CmdletParameters"];
                dataRow["ParameterValues"] = string.Join(", ", (from p in source
                                                                select string.Format("{0}: {1}", p.Name, p.Value)).ToArray <string>());
                store.SetModifiedColumns(new List <string>(new string[]
                {
                    "ParameterValues"
                }));
            }
        }
Пример #18
0
        public static void NewObjectPreAction(DataRow inputRow, DataTable table, DataObjectStore store)
        {
            DataRow       dataRow = table.Rows[0];
            bool          flag    = !(dataRow["IsNotSmtpAddress"] is DBNull) && (bool)dataRow["IsNotSmtpAddress"];
            string        text    = (dataRow["ExternalEmailAddress"] is DBNull) ? null : ((string)dataRow["ExternalEmailAddress"]);
            List <string> list    = new List <string>();

            list.Add("ExternalEmailAddress");
            if (string.IsNullOrEmpty(text))
            {
                text = (string)dataRow["MicrosoftOnlineServicesID"];
            }
            if (flag)
            {
                dataRow["ExternalEmailAddress"] = (string)dataRow["AddressPrefix"] + ":" + text;
            }
            else
            {
                dataRow["ExternalEmailAddress"] = "SMTP:" + text;
            }
            store.SetModifiedColumns(list);
        }
Пример #19
0
        public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow       dataRow = dataTable.Rows[0];
            List <string> list    = new List <string>();
            bool          flag    = false;
            bool          flag2   = false;

            if (!DBNull.Value.Equals(dataRow["AutomateProcessingAuto"]))
            {
                flag = (bool)dataRow["AutomateProcessingAuto"];
            }
            if (!DBNull.Value.Equals(dataRow["AutomateProcessingManual"]))
            {
                flag2 = (bool)dataRow["AutomateProcessingManual"];
            }
            if (flag && flag2)
            {
                throw new ArgumentException("automateProcessingAuto and automateProcessingManual cannot be true at the same time.");
            }
            if (flag || flag2)
            {
                inputRow["AutomateProcessing"] = (dataRow["AutomateProcessing"] = CalendarProcessingFlags.AutoAccept);
                inputRow["AllBookInPolicy"]    = (dataRow["AllBookInPolicy"] = flag);
                inputRow["AllRequestInPolicy"] = (dataRow["AllRequestInPolicy"] = !flag);
                list.Add("AutomateProcessing");
                list.Add("AllBookInPolicy");
                list.Add("AllRequestInPolicy");
            }
            if (!DBNull.Value.Equals(dataRow["AdditionalResponse"]))
            {
                bool flag3 = !string.IsNullOrEmpty((string)dataRow["AdditionalResponse"]);
                inputRow["AddAdditionalResponse"] = (dataRow["AddAdditionalResponse"] = flag3);
                list.Add("AddAdditionalResponse");
            }
            if (list.Count > 0)
            {
                store.SetModifiedColumns(list);
            }
        }
Пример #20
0
        public static void ResetGetPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store, PowerShellResults[] psResults)
        {
            string        name          = (string)inputRow["DataObjectName"];
            object        dataObject    = store.GetDataObject(name);
            StringBuilder stringBuilder = new StringBuilder();

            PropertyInfo[] properties = dataObject.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.GetProperty);
            int            num        = properties.Max((PropertyInfo p) => p.Name.Length);

            foreach (PropertyInfo propertyInfo in properties)
            {
                stringBuilder.Append(string.Format("{0}{1} : ", propertyInfo.Name, new string(' ', num - propertyInfo.Name.Length)));
                bool   flag  = true;
                object value = propertyInfo.GetValue(dataObject, null);
                if (value != null && value is ICollection && value.GetType().GetMethod("ToString", new Type[0]).DeclaringType == typeof(object))
                {
                    foreach (object arg in ((IEnumerable)value))
                    {
                        stringBuilder.AppendLine(string.Format("{0}{1}", flag ? string.Empty : new string(' ', num + 3), arg));
                        flag = false;
                    }
                    if (flag)
                    {
                        stringBuilder.AppendLine();
                    }
                }
                else
                {
                    stringBuilder.AppendLine((value == null) ? string.Empty : value.ToString());
                }
            }
            inputRow["FileContent"] = stringBuilder.ToString();
            store.SetModifiedColumns(new List <string>
            {
                "FileContent"
            });
        }
Пример #21
0
        public static void SetContentFilterPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow       row             = dataTable.Rows[0];
            List <string> modifiedColumns = new List <string>();

            Antispam.contentEmailListParameters.ForEach(delegate(string p)
            {
                string text = string.Format("str{0}", p);
                if (!DBNull.Value.Equals(row[text]))
                {
                    string[] array = row[text].ToString().Split(new char[]
                    {
                        ';'
                    }, StringSplitOptions.RemoveEmptyEntries);
                    MultiValuedProperty <SmtpAddress> multiValuedProperty3 = new MultiValuedProperty <SmtpAddress>();
                    foreach (string text2 in array)
                    {
                        multiValuedProperty3.Add(new SmtpAddress(text2.Trim()));
                    }
                    inputRow[text] = multiValuedProperty3;
                    modifiedColumns.Add(text);
                }
            });
            MultiValuedProperty <string> multiValuedProperty = new MultiValuedProperty <string>();

            if (!row["regionList"].IsNullValue())
            {
                foreach (object obj in ((Array)row["regionList"]))
                {
                    Identity identity = (Identity)obj;
                    multiValuedProperty.Add(identity.RawIdentity);
                }
                if (multiValuedProperty.Count > 0)
                {
                    inputRow["RegionBlockList"] = multiValuedProperty;
                }
                else
                {
                    inputRow["RegionBlockList"] = null;
                }
            }
            else
            {
                inputRow["RegionBlockList"] = null;
            }
            modifiedColumns.Add("RegionBlockList");
            MultiValuedProperty <string> multiValuedProperty2 = new MultiValuedProperty <string>();

            if (!row["languageList"].IsNullValue())
            {
                foreach (object obj2 in ((Array)row["languageList"]))
                {
                    Identity identity2 = (Identity)obj2;
                    multiValuedProperty2.Add(identity2.RawIdentity);
                }
                if (multiValuedProperty2.Count > 0)
                {
                    inputRow["LanguageBlockList"] = multiValuedProperty2;
                }
                else
                {
                    inputRow["LanguageBlockList"] = null;
                }
            }
            else
            {
                inputRow["LanguageBlockList"] = null;
            }
            modifiedColumns.Add("LanguageBlockList");
            if (!DBNull.Value.Equals(row["SentTo"]) || !DBNull.Value.Equals(row["SentToMemberOf"]) || !DBNull.Value.Equals(row["ExceptIfSentTo"]) || !DBNull.Value.Equals(row["ExceptIfSentToMemberOf"]) || !DBNull.Value.Equals(row["ExceptIfRecipientDomainIs"]))
            {
                inputRow["EnableEndUserSpamNotifications"] = false;
                modifiedColumns.Add("EnableEndUserSpamNotifications");
            }
            if (modifiedColumns.Count > 0)
            {
                store.SetModifiedColumns(modifiedColumns);
            }
        }
        public static void UpdateEmailAddresses(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            MailContact            mailContact    = store.GetDataObject("MailContact") as MailContact;
            ProxyAddressCollection emailAddresses = mailContact.EmailAddresses;
            IEnumerable <object>   enumerable     = inputRow["FilteredEmailAddresses"] as IEnumerable <object>;
            string text = inputRow["ExternalEmailAddress"] as string;

            if (enumerable != null)
            {
                for (int i = emailAddresses.Count - 1; i >= 0; i--)
                {
                    if (emailAddresses[i] is SmtpProxyAddress && !((SmtpProxyAddress)emailAddresses[i]).IsPrimaryAddress)
                    {
                        emailAddresses.RemoveAt(i);
                    }
                }
            }
            if (text != null)
            {
                ProxyAddressBase proxyAddressBase = ProxyAddress.Parse(text).ToPrimary();
                if (!(proxyAddressBase is InvalidProxyAddress) && mailContact.ExternalEmailAddress != proxyAddressBase)
                {
                    int num = emailAddresses.IndexOf((ProxyAddress)proxyAddressBase);
                    if (num >= 0)
                    {
                        emailAddresses.MakePrimary(num);
                    }
                    else
                    {
                        emailAddresses.Add(proxyAddressBase);
                    }
                    int num2 = emailAddresses.IndexOf(mailContact.ExternalEmailAddress);
                    if (num2 >= 0 && (!(emailAddresses[num2] is SmtpProxyAddress) || !emailAddresses[num2].IsPrimaryAddress))
                    {
                        emailAddresses.RemoveAt(num2);
                    }
                }
            }
            if (enumerable != null)
            {
                foreach (object obj in enumerable)
                {
                    string       text2        = (string)obj;
                    ProxyAddress proxyAddress = ProxyAddress.Parse(text2);
                    if (proxyAddress is InvalidProxyAddress)
                    {
                        InvalidProxyAddress invalidProxyAddress = proxyAddress as InvalidProxyAddress;
                        throw new FaultException(invalidProxyAddress.ParseException.Message);
                    }
                    if (emailAddresses.Contains(proxyAddress))
                    {
                        throw new FaultException(string.Format(Strings.DuplicateProxyAddressError, text2));
                    }
                    emailAddresses.Add(proxyAddress);
                }
            }
            inputRow["EmailAddresses"] = emailAddresses;
            store.SetModifiedColumns(new List <string>
            {
                "EmailAddresses"
            });
        }
Пример #23
0
        public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow       dataRow = dataTable.Rows[0];
            List <string> list    = new List <string>();

            if (!dataRow["SearchAllMailboxes"].IsNullValue() && dataRow["SearchAllMailboxes"].IsTrue())
            {
                dataRow["SourceMailboxes"] = null;
                list.Add("SourceMailboxes");
            }
            if (!dataRow["SearchAllPublicFolders"].IsNullValue() && dataRow["SearchAllPublicFolders"].IsTrue())
            {
                dataRow["PublicFolderSources"] = null;
                list.Add("PublicFolderSources");
                dataRow["AllPublicFolderSources"] = true;
                list.Add("AllPublicFolderSources");
            }
            if (!dataRow["HoldIndefinitely"].IsNullValue() && dataRow["HoldIndefinitely"].IsTrue())
            {
                dataRow["ItemHoldPeriod"] = Unlimited <EnhancedTimeSpan> .UnlimitedValue;
                list.Add("ItemHoldPeriod");
            }
            else if (!dataRow["ItemHoldPeriodDays"].IsNullValue())
            {
                dataRow["ItemHoldPeriod"] = Unlimited <EnhancedTimeSpan> .Parse((string)dataRow["ItemHoldPeriodDays"]);

                list.Add("ItemHoldPeriod");
            }
            if (!dataRow["StartDateEnabled"].IsNullValue())
            {
                if (dataRow["StartDateEnabled"].IsTrue())
                {
                    DiscoveryHoldPropertiesHelper.SetDate(dataRow, list, "StartDate", (string)dataRow["SearchStartDate"]);
                }
                else
                {
                    dataRow["StartDate"] = null;
                    list.Add("StartDate");
                }
            }
            else if (!dataRow["SearchStartDate"].IsNullValue())
            {
                DiscoveryHoldPropertiesHelper.SetDate(dataRow, list, "StartDate", (string)dataRow["SearchStartDate"]);
            }
            if (!dataRow["EndDateEnabled"].IsNullValue())
            {
                if (dataRow["EndDateEnabled"].IsTrue())
                {
                    DiscoveryHoldPropertiesHelper.SetDate(dataRow, list, "EndDate", (string)dataRow["SearchEndDate"]);
                }
                else
                {
                    dataRow["EndDate"] = null;
                    list.Add("EndDate");
                }
            }
            else if (!dataRow["SearchEndDate"].IsNullValue())
            {
                DiscoveryHoldPropertiesHelper.SetDate(dataRow, list, "EndDate", (string)dataRow["SearchEndDate"]);
            }
            DiscoveryHoldPropertiesHelper.SetChangedListProperty(dataRow, list, "SenderList", "Senders");
            DiscoveryHoldPropertiesHelper.SetChangedListProperty(dataRow, list, "RecipientList", "Recipients");
            DiscoveryHoldPropertiesHelper.SetChangedListProperty(dataRow, list, "MessageTypeList", "MessageTypes");
            if (!dataRow["SearchContent"].IsNullValue() && dataRow["SearchContent"].IsFalse())
            {
                dataRow["SearchQuery"] = DBNull.Value;
                list.Add("SearchQuery");
                dataRow["Senders"] = DBNull.Value;
                list.Add("Senders");
                dataRow["Recipients"] = DBNull.Value;
                list.Add("Recipients");
                dataRow["MessageTypes"] = DBNull.Value;
                list.Add("MessageTypes");
                dataRow["StartDate"] = DBNull.Value;
                list.Add("StartDate");
                dataRow["EndDate"] = DBNull.Value;
                list.Add("EndDate");
            }
            if (RbacPrincipal.Current.IsInRole("Set-MailboxSearch?EstimateOnly&ExcludeDuplicateMessages&LogLevel"))
            {
                dataRow["EstimateOnly"] = true;
                list.Add("EstimateOnly");
                dataRow["ExcludeDuplicateMessages"] = false;
                list.Add("ExcludeDuplicateMessages");
                dataRow["LogLevel"] = LoggingLevel.Suppress;
                list.Add("LogLevel");
            }
            store.SetModifiedColumns(list);
        }
Пример #24
0
        public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            List <string> list = new List <string>();

            if (DBNull.Value.Equals(inputRow["MinPasswordComplexCharacters"]))
            {
                inputRow["MinPasswordComplexCharacters"] = "3";
                list.Add("MinPasswordComplexCharacters");
            }
            if (DBNull.Value != inputRow["MaxPasswordFailedAttempts"] || DBNull.Value != inputRow["IsMaxPasswordFailedAttemptsSet"])
            {
                bool   isValueSet = DBNull.Value.Equals(inputRow["IsMaxPasswordFailedAttemptsSet"]) || (bool)inputRow["IsMaxPasswordFailedAttemptsSet"];
                string value      = (DBNull.Value != inputRow["MaxPasswordFailedAttempts"]) ? ((string)inputRow["MaxPasswordFailedAttempts"]) : "8";
                object value2;
                if (MobileDeviceMailboxPolicyService.CheckAndParseParams <int>(true, isValueSet, value, (string x) => int.Parse(x), out value2))
                {
                    inputRow["MaxPasswordFailedAttempts"] = value2;
                    list.Add("MaxPasswordFailedAttempts");
                    list.Add("IsMaxPasswordFailedAttemptsSet");
                }
            }
            if (DBNull.Value != inputRow["PasswordExpiration"] || DBNull.Value != inputRow["IsPasswordExpirationSet"])
            {
                bool   isValueSet = DBNull.Value.Equals(inputRow["IsPasswordExpirationSet"]) || (bool)inputRow["IsPasswordExpirationSet"];
                string value      = (DBNull.Value != inputRow["PasswordExpiration"]) ? ((string)inputRow["PasswordExpiration"]) : "90";
                object value2;
                if (MobileDeviceMailboxPolicyService.CheckAndParseParams <EnhancedTimeSpan>(true, isValueSet, value, (string x) => EnhancedTimeSpan.FromDays(double.Parse(x)), out value2))
                {
                    inputRow["PasswordExpiration"] = value2;
                    list.Add("PasswordExpiration");
                    list.Add("IsPasswordExpirationSet");
                }
            }
            if (DBNull.Value != inputRow["MaxInactivityTimeLock"] || DBNull.Value != inputRow["IsMaxInactivityTimeLockSet"])
            {
                bool   isValueSet = DBNull.Value.Equals(inputRow["IsMaxInactivityTimeLockSet"]) || (bool)inputRow["IsMaxInactivityTimeLockSet"];
                string value      = (DBNull.Value != inputRow["MaxInactivityTimeLock"]) ? ((string)inputRow["MaxInactivityTimeLock"]) : "15";
                object value2;
                if (MobileDeviceMailboxPolicyService.CheckAndParseParams <EnhancedTimeSpan>(true, isValueSet, value, (string x) => EnhancedTimeSpan.FromMinutes(double.Parse(x)), out value2))
                {
                    inputRow["MaxInactivityTimeLock"] = value2;
                    list.Add("MaxInactivityTimeLock");
                    list.Add("IsMaxInactivityTimeLockSet");
                }
            }
            if (DBNull.Value != inputRow["MinPasswordLength"] || DBNull.Value != inputRow["IsMinPasswordLengthSet"])
            {
                bool   isValueSet = DBNull.Value.Equals(inputRow["IsMinPasswordLengthSet"]) || (bool)inputRow["IsMinPasswordLengthSet"];
                string value      = (DBNull.Value != inputRow["MinPasswordLength"]) ? ((string)inputRow["MinPasswordLength"]) : 4.ToString();
                object value2;
                if (MobileDeviceMailboxPolicyService.CheckAndParseParams <int>(false, isValueSet, value, (string x) => int.Parse(x), out value2))
                {
                    inputRow["MinPasswordLength"] = value2;
                    list.Add("MinPasswordLength");
                    list.Add("IsMinPasswordLengthSet");
                }
            }
            if (list.Count > 0)
            {
                store.SetModifiedColumns(list);
            }
        }