I have to run code for creation of lists in SharePoint site (Host-web) when my SharePoint Hosted app is installing. I have 3 to 4 App-parts in my App.

Where should I write JavaScript code which will run when my app is installing.

  • You want to add list to Host-web or App-web?
    – AmitWiki
    Mar 30 '16 at 12:38
  • I want to add a list in App-web Mar 30 '16 at 12:42
  • Is it SP Hosted app or Provider hosted app?
    – AmitWiki
    Mar 30 '16 at 12:48
  • It is SP Hosted app Mar 30 '16 at 12:49

Create your script file and give reference of the file on first page which will load while installing your app. The reference should be like this

 <script src="../Scripts/yourScript.js" type="text/javascript"></script>
  • This is, in the most basic sense, correct - but not very helpful... you should explain why you need to do it this way and how "setup" of SP hosted apps is different than for provider hosted apps because of things like app permissions and server events.
    – John-M
    Mar 30 '16 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.