Posted on February 15th, 2014
In this article you will learn how to develop List Definition in SharePoint 2013 using declarative approach with the help of Visual Studio.
1. Open Visual Studio 2012 or 2013.
2. Click File – [New] – [Project] - SharePoint solutions.
3. Select SharePoint 2013 – Empty Project template.
4. Name the project “SharePointProject_ListDefinition” or name as you like :).
5. Enter the site you want to debug and select Farm solution.
6. Always create folder for grouping any similar artifacts like Site Columns, Content Types and Lists etc. In this case even though its only one I will create a folder called Lists.
a. To create a new folder, Right click on the project - [Add] – [New Folder], name it as Lists.
7. We are into actual step now creating List definition.
8. Open the elements.xml under CustomerListdefinition.
You can observe that Type will always starts with 10000 to make sure that this will not conflict with the OOB types.
9. If you want to activate the feature manually go to Project properties - select sharepoint –Set Active deployment configuration to “No Activation”.
10. Right click on project to deploy the solution. Always keep an eye on Output window in visual studio to know what is happening behind the scenes.
11. Go to [Site settings]-[Manage site features under Site Actions]- activate your feature, here “SharePointProject_ListDefinition Feature1”.
12. To see your list definition click on [Site content] – [Add an app] there you can see your “CustomerListdefinition”
Using this you can create as many lists you wish :).
With the help of Visual Studio 2012 and later versions developing list definition becomes easier compared to previous versions.
In the next article we will see how to create list instances declaratively using list definition developed in this article.
Devendra Velegandla is a five-time recipient of Microsoft's Most Valuable Professional (MVP) award (2014-2019) for Office Apps and Services, Office Servers and Services MVP and SharePoint Server. He received the MCC award for his contributions in Microsoft MSDN/TechNet forums. He loves sharing articles, videos, and tutorial on SharePoint and Office 365.