Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.