How to determine the List Template (SPListTemplate) that was used to create a list?
-
09-12-2019 - |
Question
I am using the following code to create a custom list from a custom list definition. Is there a way, after the list is created to determine which definition it was created from?
SPListTemplate template = allTemplates["Template Name"];
Guid idOfNewListInstance = web.Lists.Add("Name of List", "A new list created from template", template);
SPList newList = web.Lists[idOfNewListInstance];
How can I determine what definition/template was used to create newList
?
Solution
Do you want to get the information through code, or only through the UI? For example the ListTemplateId can be found as variable when you look at the source code of the site where the list is displayed (for example: var g_wsaListTemplateId = 100). You can get this value with javascript.
Or you can use server API: SPList.RootFolder.Properties["vti_listservertemplate"]
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange