public static bool TryCreateWebServicesService(MiniVirtualDirectory virtualDirectory, TopologyServerInfo serverInfo, Uri url, ClientAccessType clientAccessType, AuthenticationMethod authenticationMethod, out Service service) { EnumValidator.ThrowIfInvalid <ClientAccessType>(clientAccessType, "clientAccessType"); EnumValidator.ThrowIfInvalid <AuthenticationMethod>(authenticationMethod, "authenticationMethod"); if (virtualDirectory.IsWebServices) { service = new WebServicesService(serverInfo, url, clientAccessType, authenticationMethod, virtualDirectory); return(true); } service = null; return(false); }
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())); }