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; }
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; }