I have seen this question many times: Can you call external endpoints from within a plugin running inside Sandbox of Dynamics CRM Online?

Recently, I was riddled with the same situation where the sandbox did not allow me to call an external endpoint.

On a positive note, I was able to overcome this issue with a little tweak, and I thought it might be useful to share with the community.

Problem

Say we need to call a JSON-based web service from within a CRM plugin.

Code that would not work:

 

Modified Code that will work:

Learning

In a nutshell, my experience has been that you can call external services as long as you stick to base .NET classes that come packaged with the framework out of the box.