SharePoint List in SharePoint hosted Add-in



In this post you will learn how to develop a SharePoint List in SharePoint hosted Add-in.

SharePoint apps designed to provide specific functionality in SharePoint. So in this article we will talk about a simple scenario of adding the list for a Help Desk Application. That is how we are normally going to use and develop the Add-ins on SharePoint.

Developing a list in Add-ins is similar to developing them in normal  SharePoint projects that we do using visual studio 2017 with the help of a visual studio designer. You can check the article here for reference.

I created a step by step guide for you on how to create a List in SharePoint Hosted Add-in, click on the image below to download it.

List in SharePoint hosted Add-in:

Open visual studio 2017, click on new project select Apps under office/SharePoint from which select project type as Apps for SharePoint 2013.

Enter your project name, here it is List-in-SharePoint-Hosted-App.

App for SharePoint 2013


Click OK. It will open the wizard to create the project.

Select the site where you want to deploy the app. "http://sharepoint-journey.com".

Hosting option should be : SharePoint-hosted.


App for SharePoint 2013

Click Finish. It will create the project.


Step1: Create Site Column

It's time to add the required site columns to the App project. To do that right click on the project click on Add -> New Item, the below screen will come up from that select Site column, enter column name and click on Add button.


Site-column

Step2: Create Content Type

To create content type, right click on the project which has been created above step, click on Add -> New Item, the screen will come up from that select Content Type and enter the name of your content type and click Add.


content_type

Select the base content type which you want to inherit from. I am selecting Item content type as a base one.


content_type_wizard

Add the required columns to the content type.


content_type

Step3: Create list

Create a list by adding a new item to the project.

Enter the name of SharePoint  list that you want to create and click on Add. It will open the wizard to choose the list settings.


List

Use the default (Blank) template to create the list and click finish.


create_list

As a standard practice we will create the columns by selecting the content type, so click on content types button from columns tab.

Choose the content type from the dropdown menu, this populate the all content types available in the SharePoint site and content types that we have added to the project. You need to add the content type which you created before.


create_list

Setting list as starting Page:

When you deploy the App, if you want to display the list as starting page then change it in the Appmanifest.xml start page setting as "List-in-SharePoint-hosted-app/lists/Ticket Details".


Appmanifest.xml

Save the details and deploy the App project. Once you open the App from the site contents page it will open the list.


List-in-SharePoint-Hosted-App

I have documented all the steps as guide for you, click the image below to create a List in SharePoint hosted App.

Conclusion:

In this article, you have learned how to develop SharePoint list in SharePoint hosted App.

Do you want to learn more about SharePoint Online Development? Click the image below and enroll in the FREE course.


› SharePoint list in SharePoint Hosted App



Join 6,500 subscribers and receive instant access to

Devendra's Library of Resources for SharePoint Developers

About Author

Devendra Velegandla is a four-time recipient of Microsoft's Most Valuable Professional (MVP) award (2014-2017) for 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.