EWS Connect with SharePoint, Performance

For my experience using EWS with SharePoint I want to share some useful information.

When you connect to Exchange Online with SharePoint a big performance improvement is to write a console application in order to get your Service URL and pass it directly. But to do this SharePoint ask you for a certificate, the workaround is to pass a Dummy X509 CER, code bellow, comment if it help.

// <summary>
/// Gets the binding.
/// </summary>
/// <returns></returns>
public static ExchangeService GetBinding()

//Create Service
        ExchangeService service = new

//Assign Credentials
        service.Credentials = new

WebCredentials("admin@contoso.com", "password");
ServicePointManager.ServerCertificateValidationCallback +=
//Change this line by your EndPoint Url
        service.Url = new Uri("https://SERVER.outlook.com/EWS/Exchange.asmx");

return service;
catch (AutodiscoverRemoteException ex)
Console.WriteLine("Exception thrown: " + ex.Error.Message);
return null;

private static bool RemoteCertificateValidationHandler
(object sender, X509Certificate certificate,
X509Chain chain, SslPolicyErrors sslPolicyErrors)
return true; //ignore the checks and go ahead