Trying to create a list template from custom list using Powershell in SharePoint online and trying to download the template on my local machine.

How to create list template achieve above requirement

Updates in question :- How to create list template using client side object model in PowerShell? suggest links..

$site = get-spsite("http://testsite")
$web = $site.RootWeb
$list = $web.Lists["Announcements"]
SharePoint $list.SaveAsTemplate() PowerShell Command use following parameters.
$list.SaveAsTemplate(“Template Name”,”Template Title”,”Template Description”,1)

In the forth parameter of SaveAsTemplate(), if you want to save the specified site as template along with data use 1, otherwise use 0.

Eg:- $list.SaveAsTemplate("TestListTemplate.stp", "TestListTemplate", "Test List Template", $false)

Source : Creating a List template from a list with PowerShell


Based on myknowledge, it’s not feasible to export lists and libraries in SharePoint Online using PowerShell.

For detailed information about the cmdlets for SharePoint Online, please see:

Introduction to the SharePoint Online Management Shell.

Basically using CSOM you can create lists using already existing custom templates, but programmatically you cannot create new ones as SaveAsTemplate method is not exposed in CSOM API.

To create a list from existing custom template below is the code.

ClientContext context = new ClientContext("http://SiteUrl");
var web = context.Web;
context.Load(web,s => s.ListTemplates );
var listCreationInfo = new ListCreationInformation
Title = "My Jobs",
Description = "This is the job list description"
var listTemplate = site.ListTemplates.First(template => template.Name == "Jobs");
listCreationInfo.TemplateFeatureId = listTemplate.FeatureId;
listCreationInfo.TemplateType = listTemplate.ListTemplateTypeKind;
  • yes , you are right.. so please suggest some CSOM in powershell links, – Akshay Dattatray Nangare Nov 23 '15 at 13:54
  • please see my updated answer – Amit Kotha Nov 23 '15 at 16:02
  • Amit thanks for above code, give me links where i can see code for create list template using list in SharePoint online using CSOM in PowerShell – Akshay Dattatray Nangare Nov 24 '15 at 5:48
  • 1
    as u sated that "SaveAsTemplate method is not exposed in CSOM API.",so please give me some articles, for your statements.... – Akshay Dattatray Nangare Nov 24 '15 at 5:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.