Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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=2.0.0.0, 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

2 Answers 2

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

 
discard

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.