Get All List Templates in SharePoint using REST API

The example in this topic show how to use REST API to Get All List Templates in SharePoint

  • function GetAllListTemplatesFromSite()
  • {
  •        $.ajax
  •         ({
  •             // _spPageContextInfo.webAbsoluteUrl - will give absolute URL of the site where you are running the code.
  •             // You can replace this with other site URL where you want to apply the function
  •            
  •               url:  _spPageContextInfo.webAbsoluteUrl + "/_api/web/ListTemplates/",
  •             type: "GET",
  •             headers:
  •             {
  •                 // Accept header: Specifies the format for response data from the server.
  •                 "Accept": "application/json;odata=verbose",
  •             },
  •                success: function (data, status, xhr) {
  •                      var dataresults = data.d.results;                
  •                 for (var i = 0; i < dataresults.length; i++)
  •                 {
  •                      console.log("List Template Name - " + dataresults[i].Name);
  •                 }
  •                },
  •                error: function (xhr, status, error) {
  •                    console.log("Failed");
  •                }
  •         });
  • }

Similar examples using different APIs:

Thank you for reading this article. This code was tested in SharePoint 2013

We value your feedback:

Page URL:

Name:

 

Email:

 
 

Feedback:

 

© 2019 Code SharePoint