Creating a list definition

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.

Getting ready

You should have completed the previous recipes successfully.

How to do it...

  1. Launch your Visual Studio 2010 IDE as an administrator ...

Get Microsoft SharePoint 2010 Developer Compendium now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.