Subscribe:      
 

Deploying a List Definition via Visual Studio .Net 2010

Written By: Hesham Saad -- 9/27/2011 -- join -- contribute -- (14) comments -- printer friendly version

Rating: Rate --

Categories: Programming and Customizations, SharePoint 2010, SharePoint Foundation 2010

Problem

Creating a list instance from "Out of the box" predefined SharePoint lists is easy but limited. How about creating our custom list via Visual Studio .Net 2010?          

Solution

List definitions and list instances that are based on those definitions are a fundamental part of Microsoft SharePoint 2010. Microsoft Visual Studio 2010 provides a project type that makes it easier to create list definitions in XML and to create list instances that are based on those definitions. In addition, tight integration with SharePoint 2010 enables you to deploy list definitions and list instances to a SharePoint site directly from Visual Studio 2010. Let's follow the below steps :

Open Visual Studio .Net 2010 -> File (Menu) -> New -> Project  :

1


Under Installed Templates, expand "SharePoint" and select "2010" from the left side panel. -> Select "Empty SharePoint Project" from the right side panel. Type a name for your project, then click the OK button.

2

Type the URL of your local SharePoint site at the "What local site do you want to use for debugging?" textbox and choose "Deploy as a farm solution" (Differences between Farm &
Sandbox Solutions) .

3

Click on the "View" menu -> Solution Explorer -> right-click at the created solution -> Add -> New Item :

4

Select "2010" for SharePoint under "Installed Templates" from the left side panel -> select "List Definition" from the right side panel :

5

Keep/Edit the display name of the list definition , Select "Custom List" as the type of the list definition and check "Add a list intance for this list definition" :

6

As seen below is our solution with the created custom list definition and added list instance.

            7

Right click at "ListDefViaVS2010" project then select "Deploy"  in order to deploy our solution to the SharePoint site then wait till we check that the output is successfully deployed :

8

 

9

 

Now let's go to the SharePoint site to check the deployed custom list definition , Click "Site Actions" menu then "View All Site Content" :

10

As we can see below a new added list instance to our custom list definition "ListDefViaVs2010 - ListInstance1".

11

Next Steps




Learn more about SharePoint



Sponsor Information




Copyright (c) 2010-2017 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | contribute | feedback | about
Some names and products listed are the registered trademarks of their respective owners.


MSSharePointTips.com | MSSQLTips.com