In this post you will learn how to develop a SharePoint List in SharePoint hosted App.
SharePoint apps designed to provide specific functionality in SharePoint. So in this article we will talk about a simple scenario of adding the list. That is how we are normally going to use and develop the Apps on SharePoint.
Developing a list in Apps is similar to developing them in normal SharePoint projects that we do using visual studio 2012 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 App, click on the image below to download it.
Open visual studio 2012, 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.
Click OK. It will open the wizard to create the project.
Select the site where you want to deploy the app. "https://www.sharepoint-journey.com".
Hosting option should be : SharePoint-hosted.
Click Finish. It will create the project.
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.
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.
Select the base content type which you want to inherit from. I am selecting Item content type as a base one.
Add the required columns to the content type.
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.
Use the default (Blank) template to create the list and click finish.
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.
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".
Save the details and deploy the App project. Once you open the App from the site contents page it will open the list.
I have documented all the steps as guide for you, click the image below to create a List in SharePoint hosted App.
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.
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.