1

Now I could successfult create list based on list template but when i saved my list template i could say "Include Content" but when the list created by this code it was empty with no content any ideas ?

function createLists() {


var context = new SP.ClientContext('/groupcompanies/AAC');
var web = context.get_web();

var listInfo = new SP.ListCreationInformation();
listInfo.set_title('ListCreation Test');
listInfo.set_description('photo gallery picture library');
listInfo.set_templateType(SP.ListTemplateType.pictureLibrary); 
listInfo.set_templateFeatureId("00BFEA71-52D4-45B3-B544-B1C71B620109");
var list = web.get_lists().add(listInfo);




context.load(list);

context.executeQueryAsync(
     function () {
        console.log(String.format('List {0} has been created successfully',list.get_title()));
     },
     function (sender, args) {
        console.log("%c Ops!" + args.get_message(),"color:red;");
     }
);

}//end createLists
  • An alternative approach (hence not an answer) would be to provision the new lists using only code; would make your solution independent of any other assets that may or may not exist no the server, making the solution much more resilient if you needed to re-deploy, make updates, or deploy to multiple environments – John-M Feb 11 '15 at 14:21
2

The FeatureId 00BFEA71-52D4-45B3-B544-B1C71B620109 is used for Custom lists. You need to check the FeatureId of your custom template. To determine FeatureId property, you could save your list as a template, then go to List Template Gallery page (/_catalogs/lt/Forms/AllItems.aspx) and find the Feature Id value of the corresponding. list. see the answer by Vadim Gremyachev for more information: How can one create a custom list in JSOM based on a custom list template (STP) in 2013?

  • thats the post that i followed i already did and i got tottaly new created list no fields no contents see thats my list templates gallery and the same featureID shown 1drv.ms/1FtYzxd – Ahmed Aborady Feb 10 '15 at 14:30
  • The one which is selected in the screenshot has GUID ending with 100 but you are using the one ending with 109. – Nadeem Yousuf Feb 10 '15 at 14:39
  • yes its the other one on the top ending with 109 i tried both of them with diffirent GUID and templateType but the smame result only creating list empty new one – Ahmed Aborady Feb 10 '15 at 14:51
  • i think this post is a solution but with Csom i dunno how to use it sharepoint.stackexchange.com/questions/104611/… u've any idea ? – Ahmed Aborady Feb 10 '15 at 16:15

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.