Friday, July 23, 2010

SharePoint 2010 Web part Development

Introduction to SharePoint 2010 Web part Development: Build and Deploy

1. Open VS.NET 2010 and create new project select SharePoint 2010

2.Start by using the Empty SharePoint Project template. Create an empty project[FW 3.5 or 4]. On the next dialogue, pick farm solution or sandboxed solutions. Provide the URL of the location to deploy. Ex:http://servername/sites/sitecollectionname
This will give a SharePoint project example : RajWebPart
3.Right click on the project and add new item and select Web part template type and enter project name as WebPart2010.

4.Add a new label and text.

5.Compile and deploy. The brilliant IDE will take of creating .webpart files and adding safe controls entry to the web.config file.



You can note a Feature files is automatically created and this web part is added as a Feature item. Set the Feature scope as Site. A package file is also given out of the box.


 
 
 
 
6.Checking the web part gallery, you can see WebPart2010.webpart file just created also preview it. Let’s add it to a page and see how it looks.
To Debug set a breakpoint and choose debug from the build menu like we add to any other type of project.
Enjoy!