This topic has not yet been rated - Rate this topic

SPListTemplate Class

Represents a list definition or a list template, which defines the fields and views for a list. List definitions are contained in files within %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\FEATURES, but list templates are created through the user interface or through the object model when a list is saved as a template.

System.Object
  Microsoft.SharePoint.SPListTemplate

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
[SubsetCallableTypeAttribute]
[ClientCallableTypeAttribute(Name = "ListTemplate", ServerTypeId = "d772ecd1-daa3-4cb1-9ea1-feea1e383fb2")]
public class SPListTemplate

Use the ListTemplates property of the SPWeb class to return an SPListTemplateCollection object that represents the collection of list definitions for a Web site. Use the GetCustomListTemplates method of the SPSite class to return an SPListTemplateCollection object that represents the collection of list templates for a site collection. Use an indexer to return a single list definition or list template from the collection. For example, if the collection is assigned to a variable named myListTemplates, use myListTemplates[index] in Microsoft Visual C#, or myListTemplates(index) in Microsoft Visual Basic, where index is the index number of the definition or template in the collection or the name of the definition or template.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Enumerate all list templates using SPListTemplate
http://www.youtube.com/watch?v=lieGahZ8w5c

SPSite site = new SPSite("http://usrtspdev02/sites/012");
SPWeb oWebSite = site.OpenWeb();
foreach (SPListTemplate template in oWebSite.ListTemplates)
{
Console.WriteLine(template.Name);
}
Enumerate all list templates using SPListTemplate

SPSite site = new SPSite("http://usrtspdev02/sites/012");
SPWeb oWebSite = site.OpenWeb();
foreach (SPListTemplate template in oWebSite.ListTemplates)
{
Console.WriteLine(template.Name);
}