2

I've created a list template based on an Issue list and it is saved in the List Template Gallery. Now how do I create a new list based on this template?

Even Mien
  • 44,393
  • 43
  • 115
  • 119

4 Answers4

3

I just encountered the same situation today.
I saved a list as a template and i wanted to use that template in a new list.
On Sharepoint 2013, go to Site Contents > Add an App >
Scroll down and you will see a page numbering saying that you are on page 1
Click on the second page and all your saved templates will be there

3
string internalName = "MyListTemplateName";
SPListTemplate t = null;
    foreach (SPListTemplate template in web.ListTemplates)
     {
       if (template.InternalName.Equals(internalName)
       {
          t = template;
          break;
       }
    }    
        web.Lists.Add("nameoflist", "description", t);
Johan Leino
  • 3,473
  • 1
  • 26
  • 27
0

I'm surprised that Johan Leino's answer is marked as useful multiple times as it doesn't work in this particular case. If you create a template yourself, web.ListTemplates does not store it and you won't be able to create the list. It's only working for out-of-the-box templates.
If you want to create a list based on your custom template you need to do it this way:

SPListTemplateCollection listTemplates = web.Site.GetCustomListTemplates(web);
SPListTemplate listTemplate = listTemplates["MyCustomTemplate"];
Guid listId = web.Lists.Add("My New List Name", "My Description", listTemplate);
if (listId != null) { //all good }
tsap
  • 803
  • 8
  • 10
0

It probably just took a while for the timer job to fire.

The template eventually showed up as an option under Lists > Create > Tracking section after a few minutes.

Even Mien
  • 44,393
  • 43
  • 115
  • 119