Export (0) Print
Expand All

The SharePoint List Sandbox Implementation

The guidance download includes an additional project, DataModels.SharePointList.Sandbox, which implements the scenario addressed by this reference implementation as a sandboxed solution. This implementation demonstrates the use of a sandbox-compatible Visual Web Part that is available from the Visual Studio Gallery. The feature manifest (elements.xml) under the Pages node is also updated to import the sandbox-compatible Visual Web Parts onto the page.

The standard Visual Web Part is not supported in the sandbox environment because Visual Web Parts effectively host an ASCX user control within the Web Part control. The ASCX file is deployed to the _controltemplates virtual directory in the physical file system on each Web front-end server. The sandbox environment does not allow you to deploy physical files to the SharePoint root, so you cannot use a sandboxed solution to deploy a Visual Web Part based on the Visual Studio 2010 Visual Web Part project template. The sandbox-compatible Visual Web Part gets around this limitation by generating and compiling the code that represents the ASCX user control as part of the assembly, thereby obviating the need to deploy any files to the server.

Certain types of LINQ to SharePoint queries will fail and throw a security exception in the sandbox environment. One of the operations that cause this failure is the StartsWith method. In order to avoid this limitation, the sandbox version performs an exact match rather than a partial match when searching. This limitation is likely to be fixed in a future update.

Show:
© 2014 Microsoft