SharePoint 2016/2013: Create list instance and list definition using Visual Studio
Check out Best Alternative to InfoPath -> Try Now
This SharePoint 2016 tutorial, we will discuss how to create a list instance and list definition using visual studio 2015/2017/2019 in SharePoint 2016.
Create list instance and list definition using Visual Studio in SharePoint 2016
After you install visual studio 2015/2017/2019, you might not see all the SharePoint project templated like SharePoint 2016 empty project, SharePoint 2016 – visual web part, etc. In that case, you need to install Microsoft Office Developer Tools Preview for Visual Studio 2015, you can follow this article for more information.
Then Open your visual studio 2015 and then click on File -> New Project and then from the left side expand Installed -> Templates -> Visual C# -> Office/SharePoint. From the right side click on SharePoint 2016 – Empty Project like below:
Next, in the SharePoint customization wizard choose a local site for debugging, and you can optionally validate which will validate the site. And then choose to Deploy as a farm solution like below:
Then it will make your empty solution ready like below:
Then we will add a list to the project.
Right-click on the project -> Add -> New Item. In the Add New Item dialog box choose List from the list of installed templates like below:
Then in the next step give a name for the list and choose “create a customizable list template and a list instance of it” and choose Custom List template like below. Since we are creating the list using a custom list template by default it will create one column name as Title.
Then we will add here two more single lines of text columns like Email ID and Contact Number. Then we will add a Choice column like Course. To add values to the Choice column, from the properties window expand Type and then click on Items… like below:
This will open the String Collection Editor where we can add the choice options one per line like below:
Then we will add multiple lines of text like below and then to enable Rich text mode to select RichTextMode as full HTML like below:
After this all your columns will look like below:
Then we will create a new view. Go to the Views tab and then give a name for the View and then choose the columns which you want to add to the Column like below, in these particular examples we are going to add the columns which we have created here.
By going to the List properties we can change the properties of the list like Title, List URL, Description and optionally you can check the checkbox to display list at quick launch and Hide list from a browser like below:
Now it is time to deploy the solution Right-click on the solution -> Deploy solution as shown in the fig below:
Once it deployed successfully, you can see the list got created in SharePoint 2016 site. Go to the SharePoint site, site content page, you can see the list got created.
You may like following SharePoint Visual Studio tutorials:
- SharePoint Hosted Add-in: Send Email to SharePoint group using visual studio workflow
- Create and Deploy SharePoint Hosted Add-in using Visual Studio 2017/2015
- Create a Web API for SharePoint Online
- Develop SharePoint workflows using visual studio as SharePoint hosted App
- Create a custom action group in SharePoint 2013/2016 using visual studio
- How to use asp.net repeater control in SharePoint 2013/2016 using Visual Studio
- SharePoint 2016 Develop and deploy custom feature using Visual Studio 2015
- Create a web part page using the visual studio in SharePoint 2013
- Create and deploy site pages or content pages using the visual studio in SharePoint 2013/2016
- How to create site definition using Visual Studio 2013 in SharePoint 2013
- Add navigation link in site settings navigation page SharePoint 2013 using Visual Studio 2013
- Create List Definition and List Instance in SharePoint 2013/2016 using Visual Studio 2013/2015/2016
- Create a custom master page using Visual Studio in SharePoint 2016/2013
- Create an application page in SharePoint 2013 using Visual Studio
- Create custom delegate control in SharePoint 2013/2016 using Visual Studio
Here we learned how to create a list definition and list instance in SharePoint 2016 using visual studio 2015/2017/2019.
Download SharePoint Online Tutorial PDF FREE!
Get update on Webinars, video tutorials, training courses etc.