none
How to create SPlist template using csom

    Question

  • I have a sharepoint list. I want list to save as template using CSOM. Help me!!!

                                

    using (SPSite oSPsite = new SPSite(strSiteURL))
                        {
                            oSPsite.AllowUnsafeUpdates = true;
                            using (SPWeb oSPWeb = oSPsite.OpenWeb())
                            {
                                oSPWeb.AllowUnsafeUpdates = true;
                                SPList list = oSPWeb.Lists[strListName];
                                string strbkpTemplateName = strListName + ".stp";
                                list.SaveAsTemplate(strbkpTemplateName, strbkpTemplateName.Replace(".stp", ""), "Description", isFlag);

                                list.Update();
                                oSPWeb.AllowUnsafeUpdates = false;
                            }
                            oSPsite.AllowUnsafeUpdates = false;
                        }

    Same thing i want using csom




    • Edited by Anil ROCK Tuesday, June 7, 2016 7:15 AM
    Tuesday, June 7, 2016 7:13 AM

All replies

  • As of now, I don't think there is a CSOM API for creating template.

    ---
    Rajesh
    rjesh.com| @rjesh
    You don't need to buy me a beer, if helpful just smile, vote, and mark it as answer.

    Tuesday, June 7, 2016 1:34 PM
  • HI,

    There is no CSOM API 

    https://officespdev.uservoice.com/forums/224641-general/suggestions/6527561-expose-list-saveastemplate-for-csom-api


    Please remember to click 'Mark as Answer' on the answer if it helps you

    Tuesday, June 7, 2016 9:28 PM
  • Then how can we resolve this? is there any option to do this on project online programmatically by console application?

    anil gangwar

    Thursday, June 9, 2016 10:23 AM
  • Well you could automate the browser or HTTP Post messages to automate the creation but it's a bit of a hack.
    Thursday, June 9, 2016 11:23 AM