EWS Managed API: Proxy Settings for On-Premises Exchange
Configure the existing on-premises EWS integration's WebProxy before operations, or use an empty WebProxy for a deliberate direct route.
In an existing on-premises EWS Managed API application, assign the intermediary to the service before its HTTP operations:
using System.Net;
var proxy = new WebProxy("http://proxy.example:8080")
{
Credentials = new NetworkCredential(proxyUser, proxyPassword)
};
exchangeService.WebProxy = proxy;exchangeService already holds the EWS endpoint and service settings. Its Credentials are the Exchange account; proxy.Credentials are the intermediary account. The service's default-credentials option does not fill that proxy object automatically.
For a deliberately direct connection in this API stack:
exchangeService.WebProxy = new WebProxy();An empty WebProxy selects direct behavior. A null service WebProxy instead leaves the underlying request's default proxy policy in place.
For just one on-premises host, use the intended bypass matching its actual spelling and nondefault port rather than changing the machine-wide route. Compare the EWS URL and proxy object when Outlook works: that other client can have a different route and intermediary account.