3

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?

4

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"]

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.