Section 3.5. Creating List Templates


3.5. Creating List Templates

SharePoint comes with predefined list templates for common types of lists, such as Announcements, Contacts, and Document Libraries. List templates define the fields, views, and ( optionally ) data included in new lists created from the template.

Creating a custom list template is very similar to creating a custom site template:

  1. Create a list that you want to base your template on.

  2. With the list displayed in the browser, choose Modify settings and columns Save list as template. SharePoint displays the Save as Template page.


  3. The list template gallery is similar to the site template gallery shown earlier in Figure 3-4. You can click on a template name to download the file (. stp ), rename the file with the . cab extension, and view the contents by opening it with WinZip or Extract. List template files contain an XML description of the template ( manifest.xml ) as summarized here:

     <?xml version="1.0" encoding="UTF-8"?>     <ListTemplate WebUrl="http://wombat1">         <Details>             <TemplateDescription>Demo list template.</TemplateDescription>             <TemplateTitle>NewListTemplat</TemplateTitle>             <Language>1033</Language>             <TemplateID>1</TemplateID>             <Configuration>0</Configuration>             <TemplateType>105</TemplateType>             <BaseType>0</BaseType>         </Details>         <Files>             <File Name="AllItems.aspx" Src="00000000.000"> ... </File>             <Folder Name="Attachments"> ... </Folder>             <File Name="DispForm.aspx" Src="10000000.000"> ... </File>             <File Name="EditForm.aspx" Src="20000000.000"> ... </File>             <File Name="NewForm.aspx" Src="30000000.000"> ... </File>         </Files>         <UserLists>             <List Name="{27E1B3BE-32C0-4CB3-A270-21E45D7429C8}" Title="NewListTemplate"  Description="Demo list template." Direction="0" BaseType="0" ServerTemplate="105"  Url="Lists/Contacts" Version="0"> ... </List>         </UserLists>         <WebParts> ... </WebParts>     </ListTemplate> 

    To make changes to a custom list template directly:

    1. Edit manifest.xml . You can find reference information about the elements in the SharePoint SDK Help file ( spptsdk.chm ).

    2. Package the changed file using CabArc.exe . For example, the following command line packages changes as TeamWithPics2.stp .

       CabArc n NewListTemplate2.stp manifest.xml 

    3. Upload the packaged file to SharePoint from the list template gallery (Figure 3-9).

    Custom list templates added to the list template gallery appear on the Create page in SharePoint, as shown in Figure 3-10.

    animal 3-10. Creating a list from a new custom template

    As with custom site templates, list templates are stored in the configuration database. The configuration database provides top-level resources that are available to all SharePoint sites on the server, so custom list templates are automatically available to all sites. You can't selectively add or hide custom list templates for specific sites.



Essential SharePoint
Essential SharePoint 2007: A Practical Guide for Users, Administrators and Developers
ISBN: 0596514077
EAN: 2147483647
Year: 2005
Pages: 153
Authors: Jeff Webb

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net