Exemple #1
0
        public static ExchangeConfigurationContainer GetForestInformation(out Guid forestGuid, out string forestName)
        {
            forestGuid = Guid.Empty;
            forestName = null;
            ITopologyConfigurationSession  topologyConfigurationSession   = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 40, "GetForestInformation", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\Transport\\TransportADUtils.cs");
            ExchangeConfigurationContainer exchangeConfigurationContainer = topologyConfigurationSession.GetExchangeConfigurationContainer();

            if (exchangeConfigurationContainer.Id != null && exchangeConfigurationContainer.Id.Parent != null && exchangeConfigurationContainer.Id.Parent.Parent != null)
            {
                forestName = exchangeConfigurationContainer.Id.Parent.Parent.DistinguishedName;
            }
            forestGuid = exchangeConfigurationContainer.Guid;
            return(exchangeConfigurationContainer);
        }
        internal static Dictionary <Guid, AdTagData> GetAllTags()
        {
            IConfigurationSession              tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 49, "GetAllTags", "f:\\15.00.1497\\sources\\dev\\infoworker\\src\\common\\ELC\\AdTagReader.cs");
            ExchangeConfigurationContainer     exchangeConfigurationContainer       = tenantOrTopologyConfigurationSession.GetExchangeConfigurationContainer();
            ADPagedReader <RetentionPolicyTag> allAdTags = tenantOrTopologyConfigurationSession.FindPaged <RetentionPolicyTag>(exchangeConfigurationContainer.Id, QueryScope.SubTree, null, null, 0);

            AdReader.Tracer.TraceDebug(0L, "Found Policy Tags in the AD.");
            List <RetentionPolicyTag>    theGoodTags = AdTagReader.GetTheGoodTags(allAdTags);
            Dictionary <Guid, AdTagData> dictionary  = new Dictionary <Guid, AdTagData>();

            foreach (RetentionPolicyTag retentionPolicyTag in theGoodTags)
            {
                AdTagData value = AdTagReader.FetchTagContentSettings(retentionPolicyTag);
                dictionary[retentionPolicyTag.RetentionId] = value;
            }
            return(dictionary);
        }