none
Saving a Document Library as a Template via code.

    Question

  • Hello,

    I have a requirement to be able to create configured document libraries at site collection provisioning time. This is a stop-gap solution until we build something more formal and so is driven via PowerShell and CSOM at the moment.

    So far, I have been able to:

    • Create the site collections
    • Create the document libraries
    • Add content types to the document libraries
    • Add views and other settings to the document libraries

    The bits that I am not able to do currently are:

    1. Set "Location based defaults" for the library. I have a number of default properties that I want to apply to some of the columns but I cannot find a definitive way of achieving this. Anyone have any pointers/tips for this?
    2. Save the document library as a template so that it can be recreated within the site collection. When all the properties and configuration is set, I want to make the library available for others to use within the collection. I can save the library as a STP locally and then upload it to the /lt list template gallery and that works as an available app through the collection, but the issue is that each site collection, and there will be thousands, will have different defaults needed that can only be defined at provisioning time. Any ideas of how to save the document library as a template via CSOM/REST/etc. without having to go to something like a provider hosted app.?
    3. Can we make an app on a site "Noteworthy" via script?

    Many thanks for any ideas or pointers. I am rapidly coming to the conclusion that these cannot be achieved via scripting :(

    Cheers,

    Nige.

    Thursday, May 26, 2016 7:22 AM