Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Create sharepoint app with create list on AppWeb using rest api.

$
0
0

Dear All,

I am trying following code for creating list. It is creating on HostWeb on office 365.

I want to create list in AppWeb.

Can anyone please tell me how to create list in app web on office 365 using napa tool.

Code:

var listName = "WOW";
        var executor;
 
        // Initialize the RequestExecutor with the app web URL.
        // Content Type Header is used to tell server what format data in the body contains.
        executor = new SP.RequestExecutor(appweburl);
        executor.executeAsync({
            url: appweburl + "/_api/SP.AppContextSite(@target)/web/Lists?@target='" + hostweburl + "'",
            method: "POST",
            body: "{ '__metadata': { 'type': 'SP.List' }, 'BaseTemplate': 100,'Description': '" + listName + "', 'Title':'" + listName + "'}",
            headers: {
                "content-type": "application/json; odata=verbose"
            },
            success: createListSuccessHandler,
            error: createListErrorHandler
        });

Thanks,

Harish Patil


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>