public IWebServiceBinding GetEwsBinding(DirectoryContext directoryContext)
        {
            IClientProxy clientProxy;

            switch (base.TrackingAuthorityKind)
            {
            case TrackingAuthorityKind.RemoteSiteInCurrentOrg:
            {
                ExchangeServiceBinding exchangeServiceBinding = new ExchangeServiceBinding("MessageTracking", WebServiceTrackingAuthority.noValidationCallback);
                this.SetAuthenticationMechanism(exchangeServiceBinding);
                exchangeServiceBinding.Proxy = new WebProxy();
                RemoteSiteInCurrentOrgTrackingAuthority remoteSiteInCurrentOrgTrackingAuthority = (RemoteSiteInCurrentOrgTrackingAuthority)this;
                exchangeServiceBinding.Url       = this.Uri.ToString();
                exchangeServiceBinding.UserAgent = WebServiceTrackingAuthority.EwsUserAgentString;
                exchangeServiceBinding.RequestServerVersionValue         = new RequestServerVersion();
                exchangeServiceBinding.RequestServerVersionValue.Version = VersionConverter.GetExchangeVersionType(remoteSiteInCurrentOrgTrackingAuthority.ServerVersion);
                exchangeServiceBinding.CookieContainer = new CookieContainer();
                clientProxy = new ClientProxyEWS(exchangeServiceBinding, this.Uri, remoteSiteInCurrentOrgTrackingAuthority.ServerVersion);
                break;
            }

            case TrackingAuthorityKind.RemoteForest:
                clientProxy = new ClientProxyRD(directoryContext, this.ProxyRecipient, this.Domain, ExchangeVersion.Exchange2010);
                break;

            case TrackingAuthorityKind.RemoteTrustedOrg:
                clientProxy = new ClientProxyRD(directoryContext, this.ProxyRecipient, this.Domain, ExchangeVersion.Exchange2010_SP1);
                break;

            default:
                throw new NotImplementedException();
            }
            return(new WebServiceBinding(clientProxy, directoryContext, this));
        }
Esempio n. 2
0
        public TrackingAuthority GetAuthorityForSiteUser(ADObjectId siteId, ADUser user)
        {
            ADObjectId id = LocalSiteCache.LocalSite.Id;

            if (siteId.Equals(id))
            {
                TraceWrapper.SearchLibraryTracer.TraceDebug(0, "Using local tracking authority for requested user.", new object[0]);
                return(CurrentSiteTrackingAuthority.Instance);
            }
            List <ServerInfo> casServers = ServerCache.Instance.GetCasServers(siteId);

            if (casServers == null || casServers.Count == 0)
            {
                TraceWrapper.SearchLibraryTracer.TraceDebug <ADObjectId>(this.GetHashCode(), "No suitable CAS servers found in site: {0}", siteId);
                return(LegacyExchangeServerTrackingAuthority.Instance);
            }
            return(RemoteSiteInCurrentOrgTrackingAuthority.Create(siteId, this.directoryContext, user));
        }
Esempio n. 3
0
        public TrackingAuthority GetAuthorityForSite(ADObjectId siteId, int minimumCasVersionRequested)
        {
            ADObjectId localServerSiteId = ServerCache.Instance.GetLocalServerSiteId(this.directoryContext);

            if (siteId.Equals(localServerSiteId))
            {
                TraceWrapper.SearchLibraryTracer.TraceDebug <ADObjectId>(this.GetHashCode(), "Using local tracking authority for site: {0}", siteId);
                return(CurrentSiteTrackingAuthority.Instance);
            }
            List <ServerInfo> casServers = ServerCache.Instance.GetCasServers(siteId);

            if (casServers == null || casServers.Count == 0)
            {
                TraceWrapper.SearchLibraryTracer.TraceDebug <ADObjectId>(this.GetHashCode(), "No suitable CAS servers found in site: {0}", siteId);
                return(LegacyExchangeServerTrackingAuthority.Instance);
            }
            bool enabled = VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).MessageTracking.UseBackEndLocator.Enabled;

            return(RemoteSiteInCurrentOrgTrackingAuthority.Create(siteId, this.directoryContext, minimumCasVersionRequested, enabled));
        }