CREATELISTFROMTEMPLATE

Creates a list in the current site based on the specified list name, description and list template name, optionally providing a feature ID. The template name must be one of the predefined values listed.

Syntax

CREATELISTFROMTEMPLATE(string listName, string description, string templateName [, GUID featureId]);

Return value

This method does not return any value.

Example: to create a new document library called Company documents:

CALL CREATELISTFROMTEMPLATE('Company documents', 'Important documents', 'Document Library');

Templates

The following templates can be used with this method.

Template name
Announcements
Contacts
Custom List
Custom List in Datasheet View
DataSources
Discussion Board
Document Library
Events
Form Library
Issues
Links
Picture Library
Survey
Tasks

Code examples

Create list

using (var command = new SharePointCommand("CALL CREATELISTFROMTEMPLATE('Zoo animals', 'Animal pictures', 'Picture Library')", connection))
{
    command.ExecuteNonQuery();
    Console.WriteLine("Last affected: " + command.LastRecordsAffected);
}

Code result

Last affected: 1


Skip Navigation Links.

Visa     MasterCard