public static string DiscoverExternalEwsUrl(ExchangePrincipal mailbox) { if (EwsHelper.discoveryEwsExternalUrl == null) { EwsHelper.discoveryEwsExternalUrl = (Func <IExchangePrincipal, Uri>)Delegate.CreateDelegate(typeof(Func <IExchangePrincipal, Uri>), Type.GetType("Microsoft.Exchange.Data.ApplicationLogic.Cafe.FrontEndLocator, Microsoft.Exchange.Data.ApplicationLogic").GetMethod("GetFrontEndWebServicesUrl", BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof(IExchangePrincipal) }, null)); } Uri uri = EwsHelper.discoveryEwsExternalUrl(mailbox); if (!(uri == null)) { return(uri.ToString()); } return(null); }