SharePoint 2016 How to create list instance and list definition using Visual Studio 2015

create list instance using visual studio 2015

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:

create list instance using visual studio 2015
create list instance using visual studio 2015

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:

Create list instance and list definition in SharePoint 2016
Create list instance and list definition in SharePoint 2016

Then it will make your empty solution ready like below:

Create list definition using Visual Studio 2015 in SharePoint 2016
Create list definition using Visual Studio 2015 in SharePoint 2016

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:

Create list definition using Visual Studio 2015 in SharePoint 2016
Create list definition using Visual Studio 2015 in SharePoint 2016

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.

Create list instance and list definition in SharePoint 2016
Create list instance and list definition in SharePoint 2016

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 list instance and list definition in SharePoint 2016

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:

Create list instance and list definition in SharePoint 2016
Create list instance and list definition in SharePoint 2016

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 2016

Create list instance and list definition in SharePoint 2016After this all your columns will look like below:

Create list definition using Visual Studio 2015 in SharePoint 2016
Create list definition using Visual Studio 2015 in SharePoint 2016

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.

Create list definition using Visual Studio 2015 in SharePoint 2016
Create list definition using Visual Studio 2015 in SharePoint 2016

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:

create list instance using visual studio 2015
create list instance using visual studio 2015

Now it is time to deploy the solution Right click on the solution -> Deploy solution as shown in the fig below:

create list instance using visual studio 2015
create list instance using visual studio 2015

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.


You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →