Below is some sample code of how to provision a list from the app web via SharePoint JavaScript object model.

function CreateList(title, url, templateType, hidden) {
     //Using the App Web as the client context
     clientContext = new SP.ClientContext.get_current();
     //Get the host web URL from the query string params
     //I have a function getHostWebUrl() - which is not included.
     // Some Ideas Here:
     var hostWebUrl = getHostWebUrl();
     //Using the hostWebContext as an AppContextSite
     hostWebContext = new SP.AppContextSite(clientContext, hostWebUrl);
     //Create List Code
     var listCreation = new SP.ListCreationInformation();

     //must use the hostWebContext to get the list in that site
     var lists = hostWebContext.get_web().get_lists();
     var list = lists.add(listCreation);
     //Always use the context of the app web to do the work or load and executing
     clientContext.executeQueryAsync(function() {
         console.log("Created List : \"" + title + "\"");
     }, function(sender, args) {
         console.log("Failed to create list : " + title);
         console.log("Reason : " + args.get_message() + "");
 // parameters : List Name, List Url, Template Type (can be ListTemplateType or Template ID, Hidden)
 CreateList("My Test List", "Lists/MyTestList", SP.ListTemplateType.genericList, false);
 CreateList("My Test List", "Lists/MyTestList", 171, false);
About the Author

Developer, Designer, Thinker, Problem Solver, Office Servers and Services MVP, & Collaboration Director @ SoHo Dragon.

View Articles