Tuesday, January 17, 2012

Creating a sandboxed solution

Creating a sandboxed solution

Sharepoint 2010 sandboxed solution are very useful for sharepoint development the main feature of sharepoint sandboxed solutions offer a way to build SharePoint Web Parts and deploy them to a site without needing administrative intervention---that is, yes you can deploy a Web Part to a SharePoint site. but you have should be a site collection administrator.

Here is the steps given for creating Sharepoint sandboxed solution

Open Visual Studio 2010 and start by creating a “Empty SharePoint Project”.

Click on image to zoom


In the next window enter your SharePoint Site URL and check if the option “Deploy as a sandboxed solution” is checked.

Click on image to zoom


Check the properties window sandbox solution is set as true 

Click on image to zoom


Now add new item to the solution

Click on image to zoom

Add a new Web Part item to the project

Click on image to zoom


Write your code in .cs file 

Click on image to zoom
 
Now you can create wsp file of your solution by simply clicking on package

Click on image to zoom

 
Or you can directly build and deploy sandbox solution to your site 

Click on image to zoom
 
The solution will now be available in the Solutions Gallery in your site (Site Actions->Site Settings and under Galleries)

Click on image to zoom
 
You can find all the user solutions there

Click on image to zoom


Now adding the webpart to your site collection:


Click the Edit icon at the top of the page to put the page in Edit mode:

Click on image to zoom
 
Click the Insert tab in the Ribbon

Click on image to zoom
 
Click the Web Part ribbon button to insert the web part.

Under Categories select Custom, and under Web Parts select your webpart. Click Add to add the web part to the page.

Click on image to zoom
 
Click the Save button to save the changes you made to the page.

Click on image to zoom

--

No comments: