Create a document based on default document template using CSOM ( JavaScript/.Net ) RRS feed

  • Question

  • Hi all :

    I am trying to create an app which will create document in a document library using the default template.

    However I failed to find any info how to do it using JavaScript CSOM or .Net CSOM. I have seen few examples like how to upload a document using JavaScript CSOM/REST or to create a simple text file in a document library using JavaScript CSOM. Couldn't find any info how to create a blank document based on the default template of a document library, using either JavaScript CSOM or .Net CSOM.

    In terms of App architecture, I can use either SharePoint hosted ( preferable option ) or Provider hosted.

    Any help will be much appreciated.


    Friday, October 24, 2014 6:15 AM


All replies

  • Hi,

    In Client Object Model, there is no such API can help us create an Office document.

    For your requirement, you can take use of the Word Object Model or other related APIs to create documents, then upload them using SharePoint Client Object Model or REST API.

    More information about Word Object Model:


    Two demos How to: Programmatically Create New Documents for your reference:   



    Best regards,


    Patrick Liang
    TechNet Community Support

    Monday, October 27, 2014 5:06 AM
  • Thanks a lot. So this means I have to go down the path of Provider Hosted App.



    Tuesday, October 28, 2014 11:39 AM
  • If its really impossible to add a new word document to a document library based on a template, as suggested by patrick, then i would consider just keeping a copy of the template in another document library (or even in the same one). It would be trivial to copy that item and give it a new name, which might be sufficient for your situation. Its what we settled on doing since we didn't immediately find a way to do what you're asking.
    Monday, October 19, 2015 7:44 PM