Friday, August 1, 2014

sharepoint 2013 Create Custom List in javascript (CSOM)

var clientContext;
var listCreationInfo;
var web;
var list;


clientContext = SP.ClientContext.get_current();
    web = clientContext.get_web();
    listCreationInfo = new SP.ListCreationInformation();
    listCreationInfo.set_title("Use");
    listCreationInfo.set_templateType(SP.ListTemplateType.genericList);
    list = web.get_lists().add(listCreationInfo);

    clientContext.load(list);

    clientContext.executeQueryAsync(
 function () { alert("Success!") },
 function () { alert("Request failed") }
);

No comments:

Post a Comment