SharePoint - Sandbox solutions
SharePoint - Sandbox Solutions
In this chapter, we will cover the deployment of Sandbox Solutions. Deploying a Sandbox solution is easier than deploying a Farm solution.
This is similar to uploading a document to a document library. When you're done with your development, you'll take the solution package and instead of giving it to your SharePoint administrator, you'll give it to an end user, someone with the privilege of owning the site collection. Then they'll take the package and upload it to the site collection solutions gallery.
As with Farm solutions, Visual Studio tools automate this deployment process during development.
Let's take a look at a simple example of a sandbox solution deployment. It is much simpler than deploying the Farm solution.
Statepe 1 - Here we need to create a new site collection and call it Demo 1.
Step 2 - Change the name of the contact list to only Contacts in FeaturesAndElements project.
Step 3 - Retract the solution by right-clicking on the project and choosing Retract. If we go back to the SharePoint system folders, you'll notice that our Feature folder is missing.
Next, if we go to Manage site features , we shouldn't see the sample feature.
Step 4 - Go back to the Visual Studio project, click on the project in Solution Explorer, and navigate to the properties window. Change the Sandbox solution to om False atTrue.
A warning dialog box appears.
This tells us that some of the items you added to the Visual Studio project will not work with Sandbox solutions and some of the SharePoint APIs. Some of the types in the SharePoint Server object model are not compatible with sandbox solutions.
Click Yes to make the change. In this case, creating a sandbox solution is like creating a farm solution, but the deployment process is completely different.
With sandbox solution, instead of deploying files to SharePoint system folders, we are deploying to SharePoint content database.
Step 5 - Go to site settings. Under the Web Designer galleries, there is the Solutions gallery.
Step 6 - Click on the Solutions link and you will see the following page where we are deploying our sandbox solutions.
You're done with the development. Instead of giving the solution package to the SharePoint administrator and then making him use PowerShell or the central administrator to deploy the farm solution, you can give your package to an end user, someone with site collection owner privilege, and then they can download the solution from the solutions gallery.
Step 7 - Return to Visual Studio, right click and select Publish to File System.
Click the Publish button to publish the new solution package in the package folder.
You will see the package in thePackage folder.
Step 8 - Now go to the SharePoint site. Click the Download Solution button option on the ribbon.
Step 9 - Navigate to your FeaturesAndElements solution. Click OK.
You will see the following dialog.
Step 10 - You just need to click on the Activate button to activate the sandbox solution
Step 11 - Access the Manage site features.
You will now see your sample functionality and when you click on Enable you should get the same behavior as we saw before.