SharePoint PowerShell create list from template

SharePoint PowerShell create list from template

In this SharePoint tutorial, we will discuss about SharePoint list templates and SharePoint list template ids.

We will cover here:

  • SharePoint list templates
  • SharePoint list template id
  • SharePoint list template gallery URL
  • SharePoint task list template
  • Get SharePoint list templates using PowerShell
  • Get SharePoint list template id
  • Get SharePoint list template type
  • Get SharePoint list templates using JavaScript
  • SharePoint list template id 851
  • SharePoint list template id 850
  • SharePoint list template id 101
  • SharePoint list template id 171
  • SharePoint list template id 3100
  • SharePoint task list template id
  • SharePoint Online list template id

Microsoft provides various SharePoint list templates that we can use to create various types of lists or libraries.

Complete SharePoint Training Course Bundle for $199 (Just for Today)

SharePoint developers or administrators uses SharePoint list template id to create list programmatically.

SharePoint list template ids and List template types

You can see the SharePoint list template ids and SharePoint list templates types from MSDN.

These list template id we can use while creating a SharePoint list programmatically. We do not need to remember these list template ids while creating a list or library using the browser.

List Template TypeTemplate IdBase TypeDescription
GenericList1000A basic list which can be adapted for multiple purposes.
DocumentLibrary1011Contains a list of documents and other files.
Survey1024Fields on a survey list represent questions that are asked of survey participants. Items in a list represent a set of responses to a particular survey.
Links1030Contains a list of hyperlinks and their descriptions.
Announcements1040Contains a set of simple announcements.
Contacts1050Contains a list of contacts used for tracking people in a site.
Events1060Contains a list of single and recurring events. An events list typically has special views for displaying events on a calendar.
Tasks1070Contains a list of items that represent completed and pending work items.
DiscussionBoard1080Contains discussions topics and their replies.
PictureLibrary1091Contains a library adapted for storing and viewing digital pictures.
DataSources1101Contains data connection description files.
XmlForm1151Contains XML documents. An XML form library can also contain templates for displaying and editing XML files via forms, as well as rules for specifying how XML data is converted to and from list items.
NoCodeWorkflows1171Contains additional workflow definitions that describe new processes that can be used within lists. These workflow definitions do not contain advanced code-based extensions.
WorkflowProcess1180Contains a list used to support execution of custom workflow process actions.
WebPageLibrary1191Contains a set of editable Web pages.
CustomGrid1200Contains a set of list items with a grid-editing view.
WorkflowHistory1400Contains a set of history items for instances of workflows.
GanttTasks1500Contains a list of tasks with specialized Gantt views of task data.
IssuesTracking11005Contains a list of items used to track issues.
sharepoint list template id

Let us see how to access SharePoint list template gallery url directly from the browser itself.

Every SharePoint site collection has a list template gallery that you can access like below:

https:///_catalogs/lt/Forms/AllItems.aspx Example: https://tsinfo.sharepoint.com/sites/TSInfoClassic/_catalogs/lt/Forms/AllItems.aspx

We can use SharePoint list template id 850 to create Page Library in SharePoint 2013/2016/2019 or in SharePoint Online. The template name is PageLibrary.

The SharePoint list template id 851 is used to create SharePoint Asset Library. And, the template name is AssetLibrary.

The SharePoint list template id 101 is used for creating a document library. And the list template name is DocumentLibrary.

The SharePoint list template id 171, we can use to create Tasks with Timeline and Hierarchy and the template name is TasksWithTimelineAndHierarchy.

The SharePoint list template id 3100 is for AccessApp.

The SharePoint task list template id is 107, we can use list template id 107 to create a tasks list in SharePoint Online or SharePoint 2013/2016/2019.

All the above list template ids will work for SharePoint Online also.

In SharePoint classic team sites, we can manage list templates, like we can save list as a template and use the SharePoint list template to create new lists.

I have written a complete blog post on Save list as a template in SharePoint 2013/2016/Online.

Let us see how to get SharePoint list templates using PowerShell. This code will work in SharePoint on-premises versions like SharePoint 2013, SharePoint 2016 or in SharePoint 2019.

Below is the PowerShell command to get list templates in SharePoint 2013/2016/2019. You can write the PowerShell script using Visual Studio Code or Windows PowerShell ISE.

The below PowerShell Cmdlets displays the list template name, type, description etc.

Add-PSSnapin "Microsoft.SharePoint.PowerShell" $SPWeb = Get-SPWeb "http://win-pfcp2dgt8di/sites/EnjoySharePoint/" $SPWeb.ListTemplates | Select Name, type, type_client, Description $SPWeb.dispose()

It will display all the list templates like below:

SharePoint PowerShell create list from template

This is how, we can get all SharePoint list templates using PowerShell.

Let us see, how to get SharePoint list template id and SharePoint list template type of a particular list in SharePoint 2013/2016/Online. This will work for classic SharePoint sites, not in SharePoint modern sites.

If you want to see the SharePoint list template used for a list then there is a very easy way to know that from the browser itself.

Ok to know this, Open the SharePoint list All Items view and then Right-click on the browser and click on View Source in IE (or View page source in Google Chrome).

Then search for “tx.listTemplate“, you will able to see something like:

ctx.listTemplate = 100; based on the template used.

The value is different for differ different types like for GenericList (CustomList) is 100, for a document library, it is 101, for Survey it is 102, etc.

There also you will be able to see list base type like below:

ctx.listBaseType=0;

SharePoint PowerShell create list from template

You can see the whole list of SharePoint list base types and list template types in this Microsoft URL.

Apart from that, you will also be able to see the SharePoint Site title, View name, view title, list name, list title, display form URL, new form URL, edit form URL etc.

So this will help you know lots of valuable information from the browser view source itself.

This is how we can get SharePoint list template id.

Now, let us see how to get SharePoint list templates using JavaScript object model (jsom) in SharePoint.

Here we will create an HTML dropdown and then using JSOM (JavaScript object model) we will bind the list templates.

HTML code to create dropdown list

Here we are creating an HTML dropdown list and are not adding options as we need to bind the dropdown on page load at run time from JSOM web property.

Below is HTML code to create the drop down as per the above requirement.

Template

SP namespace template property:

The following property is used to gets a value, that specifies the list server template.

.get_listTemplateTypeKind()

The following property is used to get the template name.

.get_name()

JSOM code to bind list template (values and name) to drop-down list:

By using following JSOM code we bind list templates to a drop-down list.

$(document).ready(function () { ExecuteOrDelayUntilScriptLoaded(retrieveListTemplate, "sp.js"); }); var templateCol; function retrieveListTemplate() { var clientContext = new SP.ClientContext.get_current(); var web=clientContext.get_web(); templateCol=web.get_listTemplates(); clientContext.load(templateCol); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed)); } function onQuerySucceeded(sender, args) { var templateEnumerator=templateCol.getEnumerator(); var option = ''; while (templateEnumerator.moveNext()) { var otemplate=templateEnumerator.get_current(); option+='';+''; } $("#ddltemplate").append(option); } function onQueryFailed(sender, args) { alert('Error: '+args.get_message() +'\n'+args.get_stackTrace()); }

This is how we can get SharePoint list templates using JavaScript and bind into a dropdown list.

If you want to use SharePoint script editor web part, then you can use the below code:

Template

You may like follow SharePoint tutorials:

In this tutorial, we learned on SharePoint list templates.

  • SharePoint list templates
  • SharePoint list template ids and List template types
  • SharePoint list template gallery url
  • SharePoint list template id 850
  • SharePoint list template id 851
  • SharePoint list template id 101
  • SharePoint list template id 171
  • SharePoint list template id 3100
  • SharePoint task list template id
  • SharePoint Online list template id
  • Manage SharePoint List templates
  • SharePoint get list templates PowerShell
  • Get SharePoint list template id
  • Get SharePoint list templates using JavaScript

Bhawana Rathore is a Microsoft MVP (3 times in Office Apps & Services) and a passionate SharePoint Consultant, having around 10 years of IT experience in the industry, as well as in .Net technologies. She likes to share her technical expertise in EnjoySharePoint.com and SPGuides.com