Forum Discussion

NotAlex's avatar
NotAlex
Iron Contributor
Jan 29, 2020

PNP Apply Template CSOM files not found

Hi All

 

I need to be able to apply pnp templates in CSOM with branding files exported from a site, please see below for details.

 

I am doing the following

  1. Getting Template and branding files using powershell with:  Get-PnPProvisioningTemplate -out "testtemplate.xml" -PersistBrandingFiles
  2. Uploading the xml and site assets folder to a document library in SharePoint
  3. Using XMLSharePointTemplateProvider in CSOM C# to get the template from SharePoint
  4. Applying the template to a site using Web.ApplyProvisioningTemplate C# CSOM (Issue)

My issue is on step 4 applying the template, the template cannot work out where the /siteassets folder is to retrieve the files it needs to upload, so I am getting a FileNotFound error.

 

It works fine if i do not use the "-persistBrandingFiles" getting the template, however we need to get the files for other reasons.

 

As far as I am aware there is no way to apply a .pnp template file in CSOM C# as all the examples only use xml. 

 

Any help would be appreciated.

 

Thanks

Alex

Resources