Пример #1
0
        private string GetEnterpriseOrE14SharingUrl(ExchangePrincipal exchangePrincipal)
        {
            SharedFolderDataEncryption.Tracer.TraceDebug <ExchangePrincipal, bool>((long)this.GetHashCode(), "Entering GetEnterpriseOrE14SharingUrl - mailbox {0}, isMultitenancyEnabled={1}", exchangePrincipal, this.IsMultitenancyEnabled);
            ServiceTopology            serviceTopology = this.IsMultitenancyEnabled ? ServiceTopology.GetCurrentLegacyServiceTopology("f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\Sharing\\SharedFolderDataEncryption.cs", "GetEnterpriseOrE14SharingUrl", 655) : ServiceTopology.GetCurrentServiceTopology("f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\Sharing\\SharedFolderDataEncryption.cs", "GetEnterpriseOrE14SharingUrl", 655);
            IList <WebServicesService> list            = serviceTopology.FindAll <WebServicesService>(exchangePrincipal, ClientAccessType.External, SharedFolderDataEncryption.serviceVersionFilter, "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\Sharing\\SharedFolderDataEncryption.cs", "GetEnterpriseOrE14SharingUrl", 658);

            if (list.Count != 0)
            {
                return(EwsWsSecurityUrl.Fix(list[0].Url.ToString()));
            }
            SharedFolderDataEncryption.Tracer.TraceDebug <ExchangePrincipal>((long)this.GetHashCode(), "Unable to find a CAS with external access in same site of user {0}. Trying other sites.", exchangePrincipal);
            WebServicesService webServicesService = serviceTopology.FindAny <WebServicesService>(ClientAccessType.External, SharedFolderDataEncryption.serviceVersionFilter, "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\Sharing\\SharedFolderDataEncryption.cs", "GetEnterpriseOrE14SharingUrl", 671);

            if (webServicesService == null)
            {
                throw new NoExternalEwsAvailableException();
            }
            return(EwsWsSecurityUrl.Fix(webServicesService.Url.ToString()));
        }
        private Uri GetEnterpriseOrE14OwaServiceUrl(IExchangePrincipal exchangePrincipal)
        {
            ServiceTopology        serviceTopology = this.IsMultitenancyEnabled ? ServiceTopology.GetCurrentLegacyServiceTopology("f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ServiceDiscovery\\OwaAnonymousVdirLocater.cs", "GetEnterpriseOrE14OwaServiceUrl", 230) : ServiceTopology.GetCurrentServiceTopology("f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ServiceDiscovery\\OwaAnonymousVdirLocater.cs", "GetEnterpriseOrE14OwaServiceUrl", 230);
            Predicate <OwaService> serviceFilter   = (OwaService service) => service.AnonymousFeaturesEnabled;
            IList <OwaService>     list            = serviceTopology.FindAll <OwaService>(exchangePrincipal, ClientAccessType.External, serviceFilter, "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ServiceDiscovery\\OwaAnonymousVdirLocater.cs", "GetEnterpriseOrE14OwaServiceUrl", 235);
            OwaService             owaService;

            if (list.Count > 0)
            {
                owaService = list[0];
            }
            else
            {
                owaService = serviceTopology.FindAny <OwaService>(ClientAccessType.External, serviceFilter, "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ServiceDiscovery\\OwaAnonymousVdirLocater.cs", "GetEnterpriseOrE14OwaServiceUrl", 247);
                if (owaService == null)
                {
                    throw new NoExternalOwaAvailableException();
                }
            }
            return(owaService.Url);
        }