For creating a list template programmatically by using server object, I'm using the SaveAsTemplate() function.

  using (SPSite oSPsite = new SPSite(strSiteURL))
    oSPsite.AllowUnsafeUpdates = true;
    using (SPWeb oSPWeb = oSPsite.OpenWeb())
      oSPWeb.AllowUnsafeUpdates = true;

      SPList list = oSPWeb.Lists[strListName];
      string bkpTemplateName = "bkp" + strListName + ".stp";
      list.SaveAsTemplate(bkpTemplateName, bkpTemplateName.Replace(".stp",""), "Description", true);

      oSPWeb.AllowUnsafeUpdates = false;
    oSPsite.AllowUnsafeUpdates = false;

But, is there a way to do the same by using CSOM?

1 Answer 1


The method SaveAsTemplate is not exposed in CSOM API, there is a general suggestion opened: Expose List.SaveAsTemplate() for CSOM API

Basically you can create lists using already existing custom templates, but programmatically you cannot create new ones.


What you can do is define the list schema xml and use it every time you have to create a new list programmatically, using the ListCreationInformation CustomSchemaXml property.

  • but exporting list schema to XML doesnt give us the data, it just just gives the schema , right? STP gives us the whole thing. Just confirming.
    – Rohit
    Nov 24, 2015 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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