SaveAsTemplate Method

The SaveAsTemplate method of the SPList class saves the list as a template in the list template gallery and includes the option of saving with or without the data contained in the current list.

Parameters

strFileName   A string that contains the file name for the list template with an .stp extension.

strName   A string that contains the title for the list template.

strDescription   A string that contains the description for the list template.

bSaveData  true to save the data of the original list along with the list template; otherwise, false.

Example

The following code example saves a list, including its user data, on a specified site as a template.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.WebControls namespaces.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security