Creating Custom List definition using Visual Studio 2010 for SharePoint 2010

InfoPath alternatives for form designing SharePoint

In this post we will discuss how we can create custom list definition using Visual Studio 2010 for SharePoint 2010. Also you can check out:

1. First you create Empty SharePoint Project under SharePoint 2010. See in fig
Creating Custom List definition using Visual Studio 2010 for SharePoint 2010
Creating Custom List definition using Visual Studio 2010 for SharePoint 2010
2. Enter the valid SharePoint Site url and select the checkbox Deploy as a Form Solution and click on Finish. See in fig.
Creating Custom List definition using Visual Studio 2010 for SharePoint 2010
Creating Custom List definition using Visual Studio 2010 for SharePoint 2010
3. Now right click solution and add new item. Here you select the installed template List Definition. See in fig.
Creating Custom List definition using Visual Studio 2010 for SharePoint 2013
Creating Custom List definition using Visual Studio 2010 for SharePoint 2016
Creating Custom List definition using Visual Studio 2010 for SharePoint 2016
4. Give the name and Select the type of list. In this dropdown list we able to select Announcements, Calendar, Contacts, Custom List, Document Library, Links and Tasks. Now I want to create custom list so I am selecting Custom List. See in fig.
Creating Custom List definition using Visual Studio 2010 for SharePoint 2013
Creating Custom List definition using Visual Studio 2010 for SharePoint 2013
5. Now you able to see your Custom list under solution. Basically in list folder three file is showing list instance, Element.xml and Schema.xml. See in fig
Creating Custom List definition using Visual Studio 2010 for SharePoint 2019
Creating Custom List definition using Visual Studio 2010 for SharePoint 2019
6. If you want to change the display name of list. Than go to under your list definition and click on list instance and open the Element.xml and change the name like see in fig.
Creating Custom List definition using Visual Studio 2010 for SharePoint 2010
Creating Custom List definition using Visual Studio 2010 for SharePoint 2010
7. Now we add the column Product name and Product Description’s. Here in SharePoint list by default the Title Column is created. So we just change the column name Title to Product name. See in fig and add the following code under element’s tag.
<Field ID=”{3E096E37-09C9-4D23-8753-55EB66CF8BB9}”
Name=”Title”
DisplayName=”Product Name”
Type=”Text”
Required=”TRUE”></Field>
<Field ID=”{3C0B5D7D-194B-4AE4-8A18-6BD1F5DFE9C8}”
Name=”Product_description”
DisplayName=”Product_description”
Type=”Text”
Required=”TRUE”></Field>
Now we add the own content type under the Element.xml
<ContentType
    ID=”0x010089E3E6DB8C9B4B3FBB980447E313CE94″
    Name=”Product Details Item”
    Group=”Custom Content Types”
    Description=”Product Details item content type.”
    Version=”0″>
    <FieldRefs>
      <FieldRef ID=”{3E096E37-09C9-4D23-8753-55EB66CF8BB9}” />
      <FieldRef ID=”{3C0B5D7D-194B-4AE4-8A18-6BD1F5DFE9C8}” />
     </FieldRefs>
  </ContentType>
Whole code looking like this. See in fig
Creating Custom List definition using Visual Studio 2015 for SharePoint 2010
Creating Custom List definition using Visual Studio 2015 for SharePoint 2010
8. Now click on schema.xml under your list definition and add the following code
<ContentTypeRef ID=”0x010089E3E6DB8C9B4B3FBB980447E313CE94″ />
<Field ID=”{3E096E37-09C9-4D23-8753-55EB66CF8BB9}”
Name=”Title”
DisplayName=”Product Name”
Type=”Text”
Required=”TRUE”></Field>
<Field ID=”{3C0B5D7D-194B-4AE4-8A18-6BD1F5DFE9C8}”
Name=”Product_description”
DisplayName=”Product_description”
Type=”Text”
Required=”TRUE”></Field>
Now schema.xml looks like this –
Creating Custom List definition using Visual Studio 2010 for SharePoint 2013
Creating Custom List definition using Visual Studio 2010 for SharePoint 2013
9. Now we add the column for view purpose under the view tag in schema.xml file. And remember that BaseViewID=1
<FieldRef Name=”Title”></FieldRef>
<FieldRef Name=”Product_description”></FieldRef>
Now code looks like this –
Creating Custom List definition using Visual Studio 2015 for SharePoint 2010
Creating Custom List definition using Visual Studio 2015 for SharePoint 2010
10. Now Save and deploy your project. Right click your project and select deploy.
Creating Custom List definition using Visual Studio 2010 for SharePoint 2013
Creating Custom List definition using Visual Studio 2010 for SharePoint 2013
11. See the output in visual studio. Deploy and build is successful.
Creating Custom List definition using Visual Studio 2015 for SharePoint 2016
Creating Custom List definition using Visual Studio 2015 for SharePoint 2016
12. Now you go to your SharePoint and refresh the page and see the list with your definition’s. See in fig
Creating Custom List definition using Visual Studio 2010 for SharePoint 2010
Creating Custom List definition using Visual Studio 2010 for SharePoint 2010

Similar SharePoint 2013 Tutorials


About Navneet Singh

I am Navneet Singh, Working at C3it software solutions pvt. ltd. in Pune. My core skills are SharePoint 2013, Office 365, SharePoint 2010, SharePoint Designer, SharePoint Designer Workflow, Nintex Workflow, Infopath, Webpart, CSOM/SSOM, Power-shell, C#, ASP.NET and SQL Server.

View all posts by Navneet Singh →

Leave a Reply