SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a custom web part that aggregates list data across web applications. I would like to keep it sandboxed if at all possible.

I first tried to use the out of the box SharePoint web services (listdata.svc) for Data Access, but encountered this error (I think this has to do with the sandbox code service running with partial trust.):

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Is there a configuration I could change on the sandbox code service to allow web requests? If not, what would you recommend as the best way to perform the data access (while staying sandboxed)?

share|improve this question
up vote 9 down vote accepted

You are not allowed to call ANYTHING outside of the Sandbox. A call to listdata.svc is a call outside the sandbox, requiring System.Net.WebPermissions. This is prohibited by the CAS policies on the Sandbox.

You basically have three ways to get around this:

  1. Use client side code (JavaScript)
  2. Use a farm solution
  3. Build a Sandbox Full-Trust proxy solution
share|improve this answer

By default, code access security denies WebPermission to code running in a sandboxed solution (see Restrictions on Sandboxed Solutions in SharePoint 2010)

However, you can create a full-trust proxy operation that will enable you to call the services. (see Sandboxed Solutions in Partnership with Full-Trust Proxies in SharePoint 2010)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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