Hi all,
I want to create a library from a template, the code that been testing it:
and this modifies the example below but I have not had any success, do not know how to associate a custom list.
thank you very much! for their help
Example :
function runCode() {
var clientContext = new SP.ClientContext.get_current();
if (clientContext != undefined && clientContext != null) {
var web = clientContext.get_web();
var listTemplates = web.get_listTemplates();
var templateTestLibrary = listTemplates.getByName(‘TemplateLibrary_v23’);
var listCreationInfo = new SP.ListCreationInformation();
listCreationInfo.set_title(‘test creation library’);
// listCreationInfo.set_templateType(SP.ListTemplateType.discussionBoard);
listCreationInfo.set_templateType(templateTestLibrary);
this.list = web.get_lists().add(listCreationInfo);
clientContext.load(list);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
}
function onQuerySucceeded() {
var result = ‘ Added Discussion Board: ‘ + this.list.get_title();
alert(result);
}
function onQueryFailed(sender, args) {
alert(‘Request failed. ‘ + args.get_message() + ‘\n’ + args.get_stackTrace());
}
Try this http://stackoverflow.com/questions/9840116/creating-a-list-based-on-a-list-definition-template
I am not a developer but this should be as simple as grabbing the custom template and using that for list creation.