private List <SmtpAddress> GetEnabledCrossPremiseRemoteDomainTargets(IConfigurationSession session) { List <SmtpAddress> list = new List <SmtpAddress>(); ADObjectId adChildRoot = CrossPremiseTestMailFlowHelper.GetAdChildRoot(CrossPremiseTestMailFlowHelper.GetAdFirstOrgRoot(session, "Global Settings"), "Internet Message Formats"); if (adChildRoot == null) { return(list); } IList <DomainContentConfig> list2; if (!CrossPremiseTestMailFlowHelper.TryLoadAdObjects <DomainContentConfig>(session, adChildRoot, out list2)) { return(list); } foreach (DomainContentConfig domainContentConfig in list2) { if (!domainContentConfig.DomainName.IncludeSubDomains && domainContentConfig.TrustedMailOutboundEnabled) { SmtpAddress item = new SmtpAddress("FederatedEmail.4c1f4d8b-8179-4148-93bf-00a95fa1e042", domainContentConfig.DomainName.Domain); if (item.IsValidAddress) { list.Add(item); } } } return(list); }
private static ADObjectId GetAdFirstOrgRoot(IConfigurationSession session, string groupName) { return(CrossPremiseTestMailFlowHelper.GetAdChildRoot(session.GetOrgContainerId(), groupName)); }