4

I'm using PnP

GetProvisioningTemplate()

method to create Provisioning Template from existing site(have some document libraries with folders and files) and applying to newly created sites, using PnP

ApplyProvisioningTemplate()

Its working fine interms of creation and applying themes, CSS etc.,But its not copying contents of document library. Is there any way can include the library contents on template(XML)file. I'm following Link from OfficeDev

3
  • Any Comments...
    – Arun
    Jun 24, 2016 at 10:01
  • Do you have any relevant code?
    – Abbas
    Nov 29, 2016 at 10:45
  • @Abbas Pls check the above mentioned link. It has sample code in GitHub which is downloadable...
    – Arun
    Jan 23, 2017 at 6:12

2 Answers 2

2

To create folders within a document library, you must enter the folder within the given ListInstance. Folders can be nested to create sub-folders.

<pnp:ListInstance Title="My Doc Lib">
  <pnp:Folders>
    <pnp:Folder Name="1. Admin" />
    <pnp:Folder Name="2. SharePoint">
      <pnp:Folder Name="2A. PnP Sub Folder" />
    </pnp:Folder>
    <pnp:Folder Name="3. Etc" />
  </pnp:Folders>
</pnp:ListInstance>
1

To provision folders inside custom document library, use pnp:Directory, a sub node under pnp:Files.

    <pnp:Files>
       <pnp:Directory Src="StyleLibrary" Folder="{sitecollection}/Style 
       Library/" Overwrite="true" Level="Published" Recursive="false" 
       IncludedExtensions="*.*" ExcludedExtensions="" MetadataMappingFile="">
      </pnp:Directory>
    </pnp:Files>

src="StyleLibrary", StyleLibrary is the folder to be provisioned and is placed in the same folder that the provisioning console exe is placed.

0

Your Answer

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

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