Deploying a List Definition via Visual Studio .Net 2010

By:   |   Updated: 2011-09-27   |   Comments   |   Related: > SharePoint


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  :

start page

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.

new project

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) .

customization wizard

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

solution explorer

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

online templates

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":

choose list definition settings

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

solution explorer

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:

deploy
output

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

site actions

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

content and structure reports
Next Steps


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Hesham Saad Hesham Saad

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips


Article Last Updated: 2011-09-27

Comments For This Article

















get free sql tips
agree to terms