Saving a Document Library as a Template (.STP)


  • Has anyone managed to build something for Office 365/SharePoint Online that enables a Document Library to be saved as a template in a site collection via CSOM?

    I have a requirement to build a document library at site collection provisioning time. The library has content types added, views configured and versioning set. This is all achieved client side via Powershell and CSOM and works as expected.

    However, I have 2 further requirements that I am really struggling with and am rapidly coming to the conclusion that they cannot be solved via PowerShell and CSOM.

    1. The first is to set location based defaults form the library. I can't seem to find anything that definitely describes how to do this. 
    2. When that is set, I need to save the configured up library as a template in the site collection. Then, when the user wants a new document library, they can pick up my preconfigured one in preference to the "Documents" default app.

    I can manually save the library as a STP and then upload that template as part of CSOM actions by copying the STP to the list gallery but I really need each template to be unique to the site collection as the location based defaults are likely to be different and I am working with many thousand site collections.

    Anyone got any ideas or pointers?

    Also, if anyone has figured out how to make an app "Noteworthy" I would be forever in your debt :)


    Wednesday, May 25, 2016 7:06 PM