Developing a SPHostedApp for registering (petty)incomes and store it in a list programatically. May I know the best option : whether to create manually a SPcustom list and then write code that inserts rows into it or create a list inside the VSproject and store there? This app may be used later to be used in different client SP sites. Also this app needs to be installed and uninstalled easily any item. In that case will I lose the data earlier entered? TIA
The list which will store the data should be packaged inside the Add-in (App). So the best practice is to create the list through the Add-in and not manually. Now another consideration for you is where should be this list located.
- List in App Web: The list will be created in the Add-ins web. So when the Add-in is uninstalled , whole data will be lost.You can create list decalratively.Follow this post.
- List in Host Web : List is created in the site where the Add-in is installed. Data will be preserved even after Add-in is uninstalled.You cannot create list in host web declaratively, you will have to write JSOM to create list. Follow this post.
Make sure you give App
Managepermission on host web in this case.