In all the previous recipes, when we deployed the content type, we had to manually create a list based on the content type using the SharePoint UI. We can create list instances based on the content type using Visual Studio without going through the SharePoint UI.
In this recipe, we will create a custom content type called an Expense
content type and based on that content type, we will create a list Definition
and list Instance
.
Our Expense content type will be based on an Item content type and will have three fields named Title, Amount, and Expense category which is a choice field.
Launch your Visual Studio 2010 IDE as an administrator (right-click the shortcut and select Run as administrator).
Select File | New | Project. The new project wizard dialog box will be displayed. (Make sure to select .NET Framework 3.5 in the top drop-down box).
Select List Definition project under Visual...