The challenge in SharePoint development has always been the balance between creating and deploying solutions that can be trusted for not damaging or impairing a SharePoint farm. However, now onwards SharePoint administrators can be tension-free about the safety of their Farm—thanks to SharePoint 2010’s Sandbox Solutions! Simply put, a Sandbox Solution is a compiled application which runs in a controlled environment, known as the Sandbox. As it runs in a controlled environment, elements such as resource throttling, access permissions, etc. can be managed by the administrator protecting the Server Farm from the negative effects of coding mistakes.
How to Deploy a Sandbox Solution?
The structure of a sandbox solution is very similar to a farm solution, which generally runs with full-trust permissions. The main differences lie in how a sandbox solution is deployed and in the process that hosts the solution (which determines whether a solution is a sandboxed solution or a farm solution). This means that the same sandboxed solution can run with full trust when it’s deployed at the farm level and with partial trust when it’s deployed at the site collection level.
A SharePoint solution is a deployable package that can contain features and assemblies. The solution package is a .cab-based file with a .wsp extension. Visual Studio 2010 SharePoint project templates create .wsp package files. A solution might contain a number of SharePoint features, and these features provide functionality such as Web Parts, list definitions, modules, and event receivers.
Site collection administrators now have the authority to upload, activate, delete, and manage sandboxed solutions using the new Solution Gallery, which is a repository of sandboxed solutions. The gallery also enables a site collection administrator to monitor a solution’s usage against a resource quota. The Solution Gallery is simply a standard SharePoint list that stores the .wsp file. It is located under the _catalogs folder at _catalogs/solutions. The gallery is added to your site collection when you upgrade from a SharePoint 2007 site collection. You open the Solution Gallery by first clicking Site Settings on the Site Actions menu. Then, on the Site Settings page, click Solutions under the Galleries section.
Deploying a sandboxed solution to the site collection is as simple as uploading the .wsp file to the gallery and activating it. Clicking the Upload Solution button gives you the option to upload a single .wsp file or multiple files. When the upload document form opens, browse for the location of the .wsp file or files you want to deploy. Next, you are prompted to activate the solution. When you activate a solution, site-collection-scoped features are automatically activated as well, but you must go to each site to activate site-scoped features from the Manage Site Features page. The Solution Gallery lists a solution’s name and modified date as well as its activated status and the resources consumed by the solution. You can delete a solution from the gallery only after you have deactivated it. If you want to copy a solution from one site collection to another, save the .wsp file to disk and upload it to another Solution Gallery.
You can also use new solution and feature upgrade infrastructure features in SharePoint 2010 to upgrade sandboxed solutions. To upgrade a solution, you need to create a .wsp file that has a new file name but the same solution ID. The easiest way to do this is to open your project in Visual Studio and make the changes, after which you can change the package name by using the package designer. Double-click the Package node in your solution to open the package designer, and then change the name of the package. You can now upload the sandboxed solution package as you would a new package. SharePoint detects that a package with the same solution ID is installed and prompts you to upgrade. After you upgrade, you’ll see that the new version is activated and the old version deactivated.
All in all, the sandboxed applications are very capable and can do most of the tasks that a business user needs. It provides the ability to break out in a safe way when you need to. The real benefit is the speed at which you can deploy your solutions into the enterprise. You no longer need to follow a grueling process of testing and validation for every solution you create, although good software practices should always be followed. Site collection administrators will be able to control their own collections and run the right solutions for their site. Farm administrators will be free from the tasks of controlling and managing all the requests for solution installs and be able to focus on the overall health of the farm with a set of rich monitoring tools.
sharepoint web services, sharepoint moss 2007