Esempio n. 1
0
        static RbacModule()
        {
            HashSet <string> hashSet = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase);
            string           configStringValue;

            if (Util.IsDataCenter)
            {
                configStringValue = AppConfigLoader.GetConfigStringValue("IframeablePagesForDataCenter", null);
            }
            else
            {
                configStringValue = AppConfigLoader.GetConfigStringValue("IframeablePagesForOnPremises", null);
            }
            if (!string.IsNullOrEmpty(configStringValue))
            {
                if (configStringValue == "*")
                {
                    RbacModule.bypassXFrameOptions = true;
                }
                else
                {
                    RbacModule.bypassXFrameOptions = false;
                    foreach (string item in configStringValue.Split(new char[]
                    {
                        ','
                    }))
                    {
                        hashSet.Add(item);
                    }
                }
            }
            RbacModule.xFrameOptionsExceptionList = hashSet;
        }
Esempio n. 2
0
        // Token: 0x0600144F RID: 5199 RVA: 0x00075368 File Offset: 0x00073568
        public Configuration()
        {
            bool               configBoolValue     = AppConfigLoader.GetConfigBoolValue("InferenceDataCollectionIsLoggingEnabled", true);
            LoggingLevel       configEnumValue     = AppConfigLoader.GetConfigEnumValue <LoggingLevel>("InferenceDataCollectionLoggingLevel", LoggingLevel.Debug);
            string             configStringValue   = AppConfigLoader.GetConfigStringValue("InferenceDataCollectionLogPath", Configuration.DefaultLogPath);
            TimeSpan           configTimeSpanValue = AppConfigLoader.GetConfigTimeSpanValue("InferenceDataCollectionMaxLogAge", TimeSpan.Zero, TimeSpan.MaxValue, TimeSpan.FromDays(30.0));
            ByteQuantifiedSize byteQuantifiedSize  = ConfigurationUtils.ReadByteQuantifiedSizeValue("InferenceDataCollectionMaxLogDirectorySize", ByteQuantifiedSize.FromGB(1UL));
            ByteQuantifiedSize byteQuantifiedSize2 = ConfigurationUtils.ReadByteQuantifiedSizeValue("InferenceDataCollectionMaxLogFileSize", ByteQuantifiedSize.FromMB(10UL));

            base.MetadataLogConfig                = new LogConfig(configBoolValue, "InferenceMetadata", "InferenceMetadata", Path.Combine(configStringValue, "Metadata"), new ulong?(byteQuantifiedSize.ToBytes()), new ulong?(byteQuantifiedSize2.ToBytes()), new TimeSpan?(configTimeSpanValue), 4096);
            base.DiagnosticLogConfig              = new DiagnosticLogConfig(configBoolValue, "InferenceDataCollection", "InferenceDataCollection", configStringValue, new ulong?(byteQuantifiedSize.ToBytes()), new ulong?(byteQuantifiedSize2.ToBytes()), new TimeSpan?(configTimeSpanValue), configEnumValue);
            base.MailboxReprocessAge              = AppConfigLoader.GetConfigTimeSpanValue("InferenceDataCollectionMailboxReprocessAge", TimeSpan.Zero, TimeSpan.MaxValue, TimeSpan.FromDays(30.0));
            base.ModuloNumberToRandomize          = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionModuloNumberToRandomize", 1, int.MaxValue, 500);
            this.ModuloNumberToRandomizeForGroups = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionModuloNumberToRandomizeForGroups", 1, int.MaxValue, 10);
            base.BlackListedFolders               = ConfigurationUtils.ReadCommaSeperatedStringValue("InferenceDataCollectionBlackListedFolders", null);
            base.WhiteListedFolders               = ConfigurationUtils.ReadCommaSeperatedStringValue("InferenceDataCollectionWhiteListedFolders", null);
            base.MinimumItemCountInMailbox        = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionMinimumItemCountInMailbox", 0, int.MaxValue, 0);
            base.MinimumSentItemsCount            = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionMinimumSentItemsCount", 0, int.MaxValue, 0);
            base.NumberOfItemsPerFolderToProcess  = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionNumberOfItemsPerFolderToProcess", 0, int.MaxValue, int.MaxValue);
            base.MinimumSentItemsPercentage       = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionMinimumSentItemsPercentage", 0, 100, 0);
            base.IsOutputSanitized                = AppConfigLoader.GetConfigBoolValue("InferenceDataCollectionIsOutputSanitized", true);
            base.QueryPageSize           = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionQueryPageSize", 0, 32767, 100);
            base.CollectMessageBodyProps = AppConfigLoader.GetConfigBoolValue("InferenceDataCollectionCollectMessageBodyProps", false);
            base.ChunkSize           = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionChunkSize", 1, int.MaxValue, 1000);
            base.ItemMaxAttemptCount = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionItemMaxAttemptCount", 1, 10, 3);
        }
Esempio n. 3
0
        public static void NewFFOMailUser(DataRow inputRow, DataTable table, DataObjectStore store)
        {
            NewMailUserCmdlet newMailUserCmdlet = new NewMailUserCmdlet();

            newMailUserCmdlet.Authenticator  = PswsAuthenticator.Create();
            newMailUserCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            if (!string.IsNullOrEmpty(inputRow["FirstName"].ToString()))
            {
                newMailUserCmdlet.FirstName = inputRow["FirstName"].ToString();
            }
            if (!string.IsNullOrEmpty(inputRow["Initials"].ToString()))
            {
                newMailUserCmdlet.Initials = inputRow["Initials"].ToString();
            }
            if (!string.IsNullOrEmpty(inputRow["LastName"].ToString()))
            {
                newMailUserCmdlet.LastName = inputRow["LastName"].ToString();
            }
            if (!string.IsNullOrEmpty(inputRow["ExternalEmailAddress"].ToString()))
            {
                newMailUserCmdlet.ExternalEmailAddress = inputRow["ExternalEmailAddress"].ToString();
            }
            newMailUserCmdlet.Alias                     = inputRow["Alias"].ToString();
            newMailUserCmdlet.DisplayName               = inputRow["MailUserDisplayName"].ToString();
            newMailUserCmdlet.Name                      = inputRow["MailUserDisplayName"].ToString();
            newMailUserCmdlet.Password                  = inputRow["PlainPassword"].ToString();
            newMailUserCmdlet.PrimarySmtpAddress        = inputRow["PrimarySmtpAddress"].ToString();
            newMailUserCmdlet.MicrosoftOnlineServicesID = inputRow["MicrosoftOnlineServicesID"].ToString();
            newMailUserCmdlet.Run();
            if (!string.IsNullOrEmpty(newMailUserCmdlet.Error))
            {
                throw new Exception(newMailUserCmdlet.Error);
            }
        }
Esempio n. 4
0
 public static void GetFFOMailUserList(DataRow inputRow, DataTable table, DataObjectStore store)
 {
     try
     {
         table.BeginLoadData();
         GetRecipientCmdlet getRecipientCmdlet = new GetRecipientCmdlet
         {
             Filter     = inputRow["SearchText"].ToString().ToRecipeintFilterString("((RecipientTypeDetails -eq 'UserMailbox') -or (RecipientTypeDetails -eq 'MailUser'))"),
             Properties = "Identity,DisplayName,PrimarySmtpAddress,RecipientTypeDetails"
         };
         getRecipientCmdlet.Authenticator  = PswsAuthenticator.Create();
         getRecipientCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
         foreach (Recipient recipient in getRecipientCmdlet.Run())
         {
             DataRow dataRow = table.NewRow();
             dataRow["Identity"]             = new Identity(recipient.Guid.ToString());
             dataRow["DisplayName"]          = recipient.DisplayName;
             dataRow["PrimarySmtpAddress"]   = recipient.PrimarySmtpAddress;
             dataRow["RecipientTypeDetails"] = FFOMailUser.GenerateUserTypeText(Enum.Parse(typeof(RecipientTypeDetails), recipient.RecipientTypeDetails, true));
             table.Rows.Add(dataRow);
         }
     }
     finally
     {
         table.EndLoadData();
     }
 }
Esempio n. 5
0
        public static void GetFFOMailUserSDO(DataRow inputRow, DataTable table, DataObjectStore store)
        {
            GetRecipientCmdlet getRecipientCmdlet = new GetRecipientCmdlet
            {
                Identity = ((Identity)inputRow["Identity"]).RawIdentity
            };

            getRecipientCmdlet.Authenticator  = PswsAuthenticator.Create();
            getRecipientCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            Recipient[] array = getRecipientCmdlet.Run();
            if (array == null || array.Length == 0)
            {
                throw new ExArgumentOutOfRangeException();
            }
            Recipient recipient = array.First <Recipient>();
            DataRow   dataRow   = table.Rows[0];

            dataRow["Identity"]           = new Identity(recipient.Guid.ToString());
            dataRow["DisplayName"]        = recipient.DisplayName;
            dataRow["Alias"]              = recipient.Alias;
            dataRow["PrimarySmtpAddress"] = recipient.PrimarySmtpAddress;
            dataRow["Name"]       = recipient.Name;
            dataRow["FirstName"]  = recipient.FirstName;
            dataRow["LastName"]   = recipient.LastName;
            dataRow["Title"]      = recipient.Title;
            dataRow["Department"] = recipient.Department;
            dataRow["Office"]     = recipient.Office;
            dataRow["Phone"]      = recipient.Phone;
        }
 public ClientExceptionLogConfiguration()
 {
     this.IsLoggingEnabled           = AppConfigLoader.GetConfigBoolValue("IsClientExceptionLoggingEnabled", true);
     this.LogPath                    = AppConfigLoader.GetConfigStringValue("ClientExceptionLogPath", ClientExceptionLogConfiguration.DefaultLogPath);
     this.MaxLogAge                  = AppConfigLoader.GetConfigTimeSpanValue("ClientExceptionMaxLogAge", TimeSpan.Zero, TimeSpan.MaxValue, TimeSpan.FromDays(30.0));
     this.MaxLogDirectorySizeInBytes = (long)ClientLogConfiguration.GetConfigByteQuantifiedSizeValue("ClientExceptionMaxLogDirectorySize", ByteQuantifiedSize.FromGB(1UL)).ToBytes();
     this.MaxLogFileSizeInBytes      = (long)ClientLogConfiguration.GetConfigByteQuantifiedSizeValue("ClientExceptionMaxLogFileSize", ByteQuantifiedSize.FromMB(10UL)).ToBytes();
 }
        public static void GetFFOSDOItem(DataRow inputRow, DataTable table, DataObjectStore store)
        {
            GetDistributionGroupCmdlet getDistributionGroupCmdlet = new GetDistributionGroupCmdlet
            {
                Identity = ((Identity)inputRow["Identity"]).RawIdentity
            };

            getDistributionGroupCmdlet.Authenticator  = PswsAuthenticator.Create();
            getDistributionGroupCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            DistributionGroup[] array = getDistributionGroupCmdlet.Run();
            if (array == null || array.Length == 0)
            {
                throw new ExArgumentOutOfRangeException();
            }
            DistributionGroup distributionGroup = array.First <DistributionGroup>();
            DataRow           dataRow           = table.Rows[0];

            dataRow["Identity"]             = new Identity(distributionGroup.Guid.ToString());
            dataRow["DisplayName"]          = distributionGroup.DisplayName;
            dataRow["PrimarySmtpAddress"]   = distributionGroup.PrimarySmtpAddress;
            dataRow["RecipientTypeDetails"] = DistributionGroupHelper.GenerateGroupTypeText(Enum.Parse(typeof(RecipientTypeDetails), distributionGroup.RecipientTypeDetails, true));
            dataRow["GroupType"]            = DistributionGroupHelper.GenerateGroupTypeText(Enum.Parse(typeof(RecipientTypeDetails), distributionGroup.RecipientTypeDetails, true));
            dataRow["Notes"] = distributionGroup.Notes;
            if (distributionGroup.ManagedBy == null || distributionGroup.ManagedBy.Length == 0)
            {
                dataRow["DisplayedManagedBy"] = null;
            }
            else
            {
                string[] value = (from o in distributionGroup.ManagedBy
                                  select o.Name).ToArray <string>();
                dataRow["DisplayedManagedBy"] = value;
            }
            GetGroupCmdlet getGroupCmdlet = new GetGroupCmdlet
            {
                Identity = ((Identity)inputRow["Identity"]).RawIdentity
            };

            getGroupCmdlet.Authenticator  = PswsAuthenticator.Create();
            getGroupCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            Group[] array2 = getGroupCmdlet.Run();
            if (array2 == null || array2.Length == 0)
            {
                throw new ExArgumentOutOfRangeException();
            }
            Group group = array2.First <Group>();

            if (group.Members == null || group.Members.Length == 0)
            {
                dataRow["MemberCount"] = 0;
            }
            else
            {
                dataRow["MemberCount"] = group.Members.Length;
            }
            dataRow["Notes"] = group.Notes;
        }
 // Token: 0x0600254A RID: 9546 RVA: 0x000875BC File Offset: 0x000857BC
 public OwaServerTraceLogConfiguration()
 {
     this.IsLoggingEnabled           = AppConfigLoader.GetConfigBoolValue("OWAIsServerTraceLoggingEnabled", true);
     this.LogPath                    = AppConfigLoader.GetConfigStringValue("OWATraceLogPath", OwaServerTraceLogConfiguration.DefaultLogPath);
     this.MaxLogAge                  = AppConfigLoader.GetConfigTimeSpanValue("OWATraceMaxLogAge", TimeSpan.Zero, TimeSpan.MaxValue, TimeSpan.FromDays(5.0));
     this.MaxLogDirectorySizeInBytes = (long)OwaAppConfigLoader.GetConfigByteQuantifiedSizeValue("OWATraceMaxLogDirectorySize", ByteQuantifiedSize.FromGB(1UL)).ToBytes();
     this.MaxLogFileSizeInBytes      = (long)OwaAppConfigLoader.GetConfigByteQuantifiedSizeValue("OWATraceMaxLogFileSize", ByteQuantifiedSize.FromMB(10UL)).ToBytes();
     this.OwaTraceLoggingThreshold   = AppConfigLoader.GetConfigDoubleValue("OwaTraceLoggingThreshold", 0.0, 0.0, 0.0);
 }
Esempio n. 9
0
        public static void GetFFOMailUser(DataRow inputRow, DataTable table, DataObjectStore store)
        {
            GetRecipientCmdlet getRecipientCmdlet = new GetRecipientCmdlet
            {
                Identity = ((Identity)inputRow["Identity"]).RawIdentity
            };

            getRecipientCmdlet.Authenticator  = PswsAuthenticator.Create();
            getRecipientCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            Recipient[] array = getRecipientCmdlet.Run();
            if (array == null || array.Length == 0)
            {
                throw new ExArgumentOutOfRangeException();
            }
            Recipient recipient = array.First <Recipient>();
            DataRow   dataRow   = table.Rows[0];

            dataRow["Identity"]           = new Identity(recipient.Guid.ToString());
            dataRow["FirstName"]          = recipient.FirstName;
            dataRow["LastName"]           = recipient.LastName;
            dataRow["DisplayName"]        = recipient.DisplayName;
            dataRow["WindowsLiveID"]      = recipient.WindowsLiveID;
            dataRow["City"]               = recipient.City;
            dataRow["StateOrProvince"]    = recipient.StateOrProvince;
            dataRow["PostalCode"]         = recipient.PostalCode;
            dataRow["CountryOrRegion"]    = recipient.CountryOrRegion.Name;
            dataRow["Phone"]              = recipient.Phone;
            dataRow["Office"]             = recipient.Office;
            dataRow["Notes"]              = recipient.Notes;
            dataRow["Title"]              = recipient.Title;
            dataRow["Department"]         = recipient.Department;
            dataRow["Company"]            = recipient.Company;
            dataRow["Alias"]              = recipient.Alias;
            dataRow["PrimarySmtpAddress"] = recipient.PrimarySmtpAddress;
            dataRow["Name"]               = recipient.Name;
            GetUserCmdlet getUserCmdlet = new GetUserCmdlet
            {
                Identity = ((Identity)inputRow["Identity"]).RawIdentity
            };

            getUserCmdlet.Authenticator  = PswsAuthenticator.Create();
            getUserCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            User[] array2 = getUserCmdlet.Run();
            if (array2 == null || array2.Length == 0)
            {
                throw new ExArgumentOutOfRangeException();
            }
            User user = array2.First <User>();

            dataRow["Initials"]      = user.Initials;
            dataRow["StreetAddress"] = user.StreetAddress;
            dataRow["MobilePhone"]   = user.MobilePhone;
            dataRow["Fax"]           = user.Fax;
            dataRow["HomePhone"]     = user.HomePhone;
            dataRow["WebPage"]       = user.WebPage;
        }
Esempio n. 10
0
        public static void RemoveFFOMailUser(DataRow inputRow, DataTable table, DataObjectStore store)
        {
            RemoveMailUserCmdlet removeMailUserCmdlet = new RemoveMailUserCmdlet();

            removeMailUserCmdlet.Authenticator  = PswsAuthenticator.Create();
            removeMailUserCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            removeMailUserCmdlet.Identity       = ((Identity)inputRow["Identity"]).RawIdentity;
            removeMailUserCmdlet.Run();
            if (!string.IsNullOrEmpty(removeMailUserCmdlet.Error))
            {
                throw new Exception(removeMailUserCmdlet.Error);
            }
        }
Esempio n. 11
0
        public DiagnosticsAggregationServiceletConfig()
        {
            this.Enabled = AppConfigLoader.GetConfigBoolValue("DiagnosticsAggregationServiceletEnabled", true);
            this.TimeSpanForQueueDataBeingCurrent = AppConfigLoader.GetConfigTimeSpanValue("TimeSpanForQueueDataBeingCurrent", TimeSpan.FromMinutes(1.0), TimeSpan.FromHours(1.0), TimeSpan.FromMinutes(11.0));
            this.TimeSpanForQueueDataBeingStale   = AppConfigLoader.GetConfigTimeSpanValue("TimeSpanForQueueDataBeingStale", TimeSpan.FromMinutes(1.0), TimeSpan.FromHours(10.0), TimeSpan.FromHours(1.0));
            this.LoggingEnabled = AppConfigLoader.GetConfigBoolValue("DiagnosticsAggregationLoggingEnabled", false);
            Assembly executingAssembly = Assembly.GetExecutingAssembly();
            string   path = Path.Combine(Directory.GetParent(Path.GetDirectoryName(executingAssembly.Location)).FullName, "TransportRoles\\Logs\\DiagnosticsAggregation\\");

            this.LogFileDirectoryPath = AppConfigLoader.GetConfigStringValue("DiagnosticsAggregationLogFileDirectoryPath", Path.GetFullPath(path));
            int configIntValue = AppConfigLoader.GetConfigIntValue("DiagnosticsAggregationLogFileMaxSizeInMB", 1, 10000, 2);

            this.LogFileMaxSize = ByteQuantifiedSize.FromMB((ulong)((long)configIntValue));
            int configIntValue2 = AppConfigLoader.GetConfigIntValue("DiagnosticsAggregationLogFileMaxDirectorySizeInMB", 1, 10000, 10);

            this.LogFileMaxDirectorySize = ByteQuantifiedSize.FromMB((ulong)((long)configIntValue2));
            this.LogFileMaxAge           = AppConfigLoader.GetConfigTimeSpanValue("DiagnosticsAggregationLogFileMaxAge", TimeSpan.FromMinutes(1.0), TimeSpan.FromDays(365.0), TimeSpan.FromDays(15.0));
        }
Esempio n. 12
0
        public ClientWatsonParameters(string owaVersion)
        {
            this.symbolsFolderPath          = AppConfigLoader.GetConfigStringValue("ClientWatsonSymbolsFolderPath", Path.Combine(ExchangeSetupContext.InstallPath, string.Format("ClientAccess\\Owa\\{0}\\ScriptSymbols", ResourcePathBuilderUtilities.GetResourcesRelativeFolderPath(owaVersion))));
            this.maxNumberOfWatsonsPerError = AppConfigLoader.GetConfigIntValue("ClientWatsonMaxReportsPerError", 1, int.MaxValue, 5);
            TimeSpan configTimeSpanValue = AppConfigLoader.GetConfigTimeSpanValue("ClientWatsonResetErrorCountInterval", TimeSpan.FromSeconds(1.0), TimeSpan.FromDays(1.0), TimeSpan.FromHours(1.0));

            this.resetErrorsReportedTimer = new Timer(delegate(object param0)
            {
                this.clientErrorsReported = new ConcurrentDictionary <int, int>();
            }, null, configTimeSpanValue, configTimeSpanValue);
            Version installedVersion = ExchangeSetupContext.InstalledVersion;

            this.ExchangeSourcesPath = string.Format("\\\\exsrc\\SOURCES\\ALL\\{0:D2}.{1:D2}.{2:D4}.{3:D3}\\", new object[]
            {
                installedVersion.Major,
                installedVersion.Minor,
                installedVersion.Build,
                installedVersion.Revision
            });
            this.owaVersion = owaVersion;
        }
Esempio n. 13
0
        private CmdletTaskFactory()
        {
            foreach (object obj in Enum.GetValues(typeof(TaskModuleKey)))
            {
                TaskModuleKey key = (TaskModuleKey)obj;
                TaskModuleFactory.DisableModule(key);
            }
            TaskModuleFactory.EnableModule(TaskModuleKey.RunspaceServerSettingsInit);
            TaskModuleFactory.EnableModule(TaskModuleKey.RunspaceServerSettingsFinalize);
            string configStringValue = AppConfigLoader.GetConfigStringValue("PSDirectInvokeEnabledModules", string.Empty);

            string[] array = configStringValue.Split(new char[]
            {
                ','
            }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string value in array)
            {
                TaskModuleKey key2;
                if (Enum.TryParse <TaskModuleKey>(value, true, out key2))
                {
                    TaskModuleFactory.EnableModule(key2);
                }
            }
        }
        public static void NewFFOGroup(DataRow inputRow, DataTable table, DataObjectStore store)
        {
            NewDistributionGroupCmdlet newDistributionGroupCmdlet = new NewDistributionGroupCmdlet();

            newDistributionGroupCmdlet.Authenticator      = PswsAuthenticator.Create();
            newDistributionGroupCmdlet.HostServerName     = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            newDistributionGroupCmdlet.Name               = inputRow["Name"].ToString();
            newDistributionGroupCmdlet.DisplayName        = inputRow["Name"].ToString();
            newDistributionGroupCmdlet.Alias              = inputRow["Alias"].ToString();
            newDistributionGroupCmdlet.PrimarySmtpAddress = inputRow["PrimarySmtpAddress"].ToString();
            newDistributionGroupCmdlet.Notes              = inputRow["Notes"].ToString();
            string[] managedBy = (from o in (object[])inputRow["ManagedBy"]
                                  select((Identity)o).DisplayName).ToArray <string>();
            newDistributionGroupCmdlet.ManagedBy = managedBy;
            string[] members = (from o in (object[])inputRow["Members"]
                                select((Identity)o).DisplayName).ToArray <string>();
            newDistributionGroupCmdlet.Members = members;
            newDistributionGroupCmdlet.Type    = inputRow["GroupType"].ToString();
            newDistributionGroupCmdlet.Run();
            if (!string.IsNullOrEmpty(newDistributionGroupCmdlet.Error))
            {
                throw new Exception(newDistributionGroupCmdlet.Error);
            }
        }
        public static void SetFFOGroup(DataRow inputRow, DataTable table, DataObjectStore store)
        {
            SetDistributionGroupCmdlet setDistributionGroupCmdlet = new SetDistributionGroupCmdlet();

            setDistributionGroupCmdlet.Authenticator  = PswsAuthenticator.Create();
            setDistributionGroupCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            setDistributionGroupCmdlet.Identity       = ((Identity)inputRow["Identity"]).RawIdentity;
            if (!DBNull.Value.Equals(inputRow["DisplayName"]))
            {
                setDistributionGroupCmdlet.DisplayName = inputRow["DisplayName"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["Alias"]))
            {
                setDistributionGroupCmdlet.Alias = inputRow["Alias"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["PrimarySmtpAddress"]))
            {
                setDistributionGroupCmdlet.PrimarySmtpAddress = inputRow["PrimarySmtpAddress"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["ManagedBy"]))
            {
                string[] managedBy = (from o in (object[])inputRow["ManagedBy"]
                                      select((Identity)o).DisplayName).ToArray <string>();
                setDistributionGroupCmdlet.ManagedBy = managedBy;
            }
            setDistributionGroupCmdlet.Run();
            if (!string.IsNullOrEmpty(setDistributionGroupCmdlet.Error))
            {
                throw new Exception(setDistributionGroupCmdlet.Error);
            }
            if (!DBNull.Value.Equals(inputRow["MembersRemoved"]) || !DBNull.Value.Equals(inputRow["MembersAdded"]))
            {
                string[] members = (from o in (object[])inputRow["Members"]
                                    select((Identity)o).DisplayName).ToArray <string>();
                UpdateDistributionGroupMemberCmdlet updateDistributionGroupMemberCmdlet = new UpdateDistributionGroupMemberCmdlet();
                updateDistributionGroupMemberCmdlet.Authenticator  = PswsAuthenticator.Create();
                updateDistributionGroupMemberCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
                updateDistributionGroupMemberCmdlet.Identity       = ((Identity)inputRow["Identity"]).RawIdentity;
                updateDistributionGroupMemberCmdlet.Members        = members;
                updateDistributionGroupMemberCmdlet.Run();
                if (!string.IsNullOrEmpty(updateDistributionGroupMemberCmdlet.Error))
                {
                    throw new Exception(updateDistributionGroupMemberCmdlet.Error);
                }
            }
            if (!DBNull.Value.Equals(inputRow["Notes"]))
            {
                SetGroupCmdlet setGroupCmdlet = new SetGroupCmdlet();
                setGroupCmdlet.Authenticator  = PswsAuthenticator.Create();
                setGroupCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
                setGroupCmdlet.Identity       = ((Identity)inputRow["Identity"]).RawIdentity;
                setGroupCmdlet.Notes          = inputRow["Notes"].ToString();
                if (!DBNull.Value.Equals(inputRow["ManagedBy"]))
                {
                    string[] managedBy2 = (from o in (object[])inputRow["ManagedBy"]
                                           select((Identity)o).DisplayName).ToArray <string>();
                    setGroupCmdlet.ManagedBy = managedBy2;
                }
                setGroupCmdlet.Run();
                if (!string.IsNullOrEmpty(setGroupCmdlet.Error))
                {
                    throw new Exception(setGroupCmdlet.Error);
                }
            }
        }
        public static void GetFFOItem(DataRow inputRow, DataTable table, DataObjectStore store)
        {
            GetDistributionGroupCmdlet getDistributionGroupCmdlet = new GetDistributionGroupCmdlet
            {
                Identity = ((Identity)inputRow["Identity"]).RawIdentity
            };

            getDistributionGroupCmdlet.Authenticator  = PswsAuthenticator.Create();
            getDistributionGroupCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            DistributionGroup[] array = getDistributionGroupCmdlet.Run();
            if (array == null || array.Length == 0)
            {
                throw new ExArgumentOutOfRangeException();
            }
            DistributionGroup distributionGroup = array.First <DistributionGroup>();
            DataRow           dataRow           = table.Rows[0];

            dataRow["Identity"]           = new Identity(distributionGroup.Guid.ToString());
            dataRow["DisplayName"]        = distributionGroup.DisplayName;
            dataRow["Alias"]              = distributionGroup.Alias;
            dataRow["PrimarySmtpAddress"] = distributionGroup.PrimarySmtpAddress;
            dataRow["Notes"]              = distributionGroup.Notes;
            if (distributionGroup.ManagedBy == null || distributionGroup.ManagedBy.Length == 0)
            {
                dataRow["ManagedBy"] = null;
            }
            else
            {
                dataRow["ManagedBy"] = (from g in distributionGroup.ManagedBy
                                        select new JsonDictionary <object>(new Dictionary <string, object>
                {
                    {
                        "__type",
                        "JsonDictionaryOfanyType:#Microsoft.Exchange.Management.ControlPanel"
                    },
                    {
                        "Identity",
                        new Identity(g.Name, g.Name)
                    },
                    {
                        "DisplayName",
                        g.Name
                    },
                    {
                        "Name",
                        g.Name
                    }
                })).ToArray <JsonDictionary <object> >();
            }
            dataRow["EmailAddresses"] = distributionGroup.EmailAddresses;
            GetGroupCmdlet getGroupCmdlet = new GetGroupCmdlet
            {
                Identity = ((Identity)inputRow["Identity"]).RawIdentity
            };

            getGroupCmdlet.Authenticator  = PswsAuthenticator.Create();
            getGroupCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            Group[] array2 = getGroupCmdlet.Run();
            if (array2 == null || array2.Length == 0)
            {
                throw new ExArgumentOutOfRangeException();
            }
            Group group = array2.First <Group>();

            if (group.Members == null || group.Members.Length == 0)
            {
                dataRow["Members"] = null;
            }
            else
            {
                dataRow["Members"] = (from g in @group.Members
                                      select new JsonDictionary <object>(new Dictionary <string, object>
                {
                    {
                        "__type",
                        "JsonDictionaryOfanyType:#Microsoft.Exchange.Management.ControlPanel"
                    },
                    {
                        "Identity",
                        new Identity(g)
                    },
                    {
                        "DisplayName",
                        g
                    },
                    {
                        "Name",
                        g
                    }
                })).ToArray <JsonDictionary <object> >();
            }
            dataRow["Notes"] = group.Notes;
        }
Esempio n. 17
0
        public static void SetFFOMailUser(DataRow inputRow, DataTable table, DataObjectStore store)
        {
            SetUserCmdlet setUserCmdlet = new SetUserCmdlet();

            setUserCmdlet.Authenticator  = PswsAuthenticator.Create();
            setUserCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null);
            setUserCmdlet.Identity       = ((Identity)inputRow["Identity"]).RawIdentity;
            if (!DBNull.Value.Equals(inputRow["DisplayName"]))
            {
                setUserCmdlet.DisplayName = inputRow["DisplayName"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["FirstName"]))
            {
                setUserCmdlet.FirstName = inputRow["FirstName"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["LastName"]))
            {
                setUserCmdlet.LastName = inputRow["LastName"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["Initials"]))
            {
                setUserCmdlet.Initials = inputRow["Initials"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["City"]))
            {
                setUserCmdlet.City = inputRow["City"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["Office"]))
            {
                setUserCmdlet.Office = inputRow["Office"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["StateOrProvince"]))
            {
                setUserCmdlet.StateOrProvince = inputRow["StateOrProvince"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["PostalCode"]))
            {
                setUserCmdlet.PostalCode = inputRow["PostalCode"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["CountryOrRegion"]))
            {
                setUserCmdlet.CountryOrRegion = inputRow["CountryOrRegion"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["Phone"]))
            {
                setUserCmdlet.Phone = inputRow["Phone"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["Notes"]))
            {
                setUserCmdlet.Notes = inputRow["Notes"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["Title"]))
            {
                setUserCmdlet.Title = inputRow["Title"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["Department"]))
            {
                setUserCmdlet.Department = inputRow["Department"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["Company"]))
            {
                setUserCmdlet.Company = inputRow["Company"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["StreetAddress"]))
            {
                setUserCmdlet.StreetAddress = inputRow["StreetAddress"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["MobilePhone"]))
            {
                setUserCmdlet.MobilePhone = inputRow["MobilePhone"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["Fax"]))
            {
                setUserCmdlet.Fax = inputRow["Fax"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["HomePhone"]))
            {
                setUserCmdlet.HomePhone = inputRow["HomePhone"].ToString();
            }
            if (!DBNull.Value.Equals(inputRow["WebPage"]))
            {
                setUserCmdlet.WebPage = inputRow["WebPage"].ToString();
            }
            setUserCmdlet.Run();
            if (!string.IsNullOrEmpty(setUserCmdlet.Error))
            {
                throw new Exception(setUserCmdlet.Error);
            }
        }