Пример #1
0
        // Token: 0x0600035A RID: 858 RVA: 0x00012274 File Offset: 0x00010474
        public static ADNotificationRequestCookie RegisterExchangeTopologyChangeNotification(ADNotificationCallback callback, object context, ExchangeTopologyScope topologyType)
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 387, "RegisterExchangeTopologyChangeNotification", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADNotificationAdapter.cs");
            ADObjectId childId        = topologyConfigurationSession.ConfigurationNamingContext.GetChildId("CN", "Sites");
            ADObjectId childId2       = childId.GetChildId("CN", "Inter-Site Transports").GetChildId("CN", "IP");
            ADObjectId orgContainerId = topologyConfigurationSession.GetOrgContainerId();

            ADNotificationRequest[] requests;
            switch (topologyType)
            {
            case ExchangeTopologyScope.Complete:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSubnet>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADVirtualDirectory>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ReceiveConnector>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADEmailTransport>(orgContainerId, callback, context).Requests[0]
                };
                break;

            case ExchangeTopologyScope.ServerAndSiteTopology:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0]
                };
                break;

            case ExchangeTopologyScope.ADAndExchangeServerAndSiteTopology:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0]
                };
                break;

            case ExchangeTopologyScope.ADAndExchangeServerAndSiteAndVirtualDirectoryTopology:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADVirtualDirectory>(orgContainerId, callback, context).Requests[0]
                };
                break;

            default:
                throw new ArgumentException("topologyType", "topologyType");
            }
            return(new ADNotificationRequestCookie(requests));
        }
Пример #2
0
        // Token: 0x06000354 RID: 852 RVA: 0x00012094 File Offset: 0x00010294
        private static ADNotificationRequestCookie RegisterChangeNotification <T>(T dummyObject, ADObjectId baseDN, ADNotificationCallback callback, object context) where T : ADConfigurationObject, new()
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (baseDN == null || string.IsNullOrEmpty(baseDN.DistinguishedName))
            {
                throw new ArgumentNullException("baseDN");
            }
            string forestFQDN = baseDN.GetPartitionId().ForestFQDN;

            if (!baseDN.IsDescendantOf(ADSession.GetConfigurationNamingContext(forestFQDN)) && !ADSession.IsTenantIdentity(baseDN, forestFQDN))
            {
                throw new ArgumentException(DirectoryStrings.ExArgumentException("baseDN", baseDN), "baseDN");
            }
            ADNotificationRequest adnotificationRequest = new ADNotificationRequest(typeof(T), dummyObject.MostDerivedObjectClass, baseDN, callback, context);

            ADNotificationListener.RegisterChangeNotification(adnotificationRequest);
            return(new ADNotificationRequestCookie(new ADNotificationRequest[]
            {
                adnotificationRequest
            }));
        }