I am trying to make Sandbox Visual Web Part using Power Tools.

It has given me below error

Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred.

The error came when I try to add below two lines (except below two lines of code, nothing else in the web part) Any idea how to resolve it? I mean just for below two lines of code, why should one go for farm.

ExchangeService service = new  ExchangeService(ExchangeVersion.Exchange2010);            

service.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

There have been similar cases with similar web part, I have developed Visual Web Part in Sandbox, it got worked fine, I deployed it, it worked for a day or so and the next day, it has started giving the same error.

1 Answer 1


ExchangeService class calls webservices and it's not allowed in Sandbox. You can deploy sandboxed visual web part in Full Trust and call Exchange Services.

If you are creating Visual Web Part you can't deploy it to Sandbox.

  • Could you please help me understanding how can I deploy my Visual Sandbox in Full Trust?? Thanks
    – NICK
    Commented Oct 18, 2012 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.