In this post, we will discuss how we can create a list instance and list definition using visual studio 2015 in SharePoint 2016. If you have not yet started with SharePoint 2016 then you can see few new features of SharePoint 2016 as well as the installation steps in SharePoint 2016.
After you install visual studio 2015, 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 custom list template by default it will create one column name as Title.
Then we will add here two more single line 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:
Create a list instance and list definition in SharePoint 2016
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 select RichTextMode as full HTML like below:
Create list instance and list definition in SharePoint 2016After 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 this 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 site content to see this.
Hope this will be helpful.
Download FREE SharePoint 2019 Installation PDF Guide
This FREE PDF contains, Steps by step guide to install SharePoint 2019 Preview, prerequisites, hardware and software new features. First impression to SharePoint Server 2019 new modern site, modern lists and modern document libraries.
You May Also like the Following SharePoint Online Tutorials: