Sample: C# code to have EWS Managed API code go through Fiddler on the same machine.
Having calls done with the EWS Managed API go through Fiddler is very easy. Below is an example.
public
static
void SetProxyToFiddler(ref
ExchangeService oService)
{
System.Net.WebProxy oWebProxy = null;
oWebProxy = new System.Net.WebProxy("127.0.0.1", 8888);
oService.WebProxy = oWebProxy;
}
Here is how you might call it:
ExchangeService oService = new
ExchangeService();
oService.Credentials = new
WebCredentials("test@contoso.com", "test"); // TODO: Change to your credentials
oService.Url = new
Uri("https://outlook.office365.com/EWS/Exchange.asmx"); // TODO: Change to your URL
SetProxyToFiddler(ref oService);
A few tips: Be sure to have enable decryption by going to the HTTPS tab in Tools/Options and checking on the Decrypt HTTPS traffic check box. The port Fiddler uses is 8888 by default and you can confirm the setting on the Connections tab. To see the traffic, click on a logged line and right click the Inspectors tab – this will bring up more tabs. Under Inspectors, click on the Raw tabs at the top and bottom so you can see the full request and full responses. You may need to right click on the response body to turn off auto-truncation.