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)?

2 Answers 2


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

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)

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.