Apply-PnPProvisioningTemplate fails to provision the site

Copper Contributor

Here is my scenario if you keep creating a template of a site and create a site with that template it fails on the third occurrence with below message.

  1. Create new site for e.g. "RaviSite01"
  2. Create copy of "RaviSite01" named "RaviSite02"
  3. Create copy of "RaviSite02" named "RaviSite03"
  4. PnP Provisioning will fail to create "RaviSite03"

 

temp.png

 

Here is PowerShell script to reproduce the issue,

 

Add-PSSnapin Microsoft.SharePoint.PowerShell

Connect-PnPOnline "http://officedevpnp/" -CurrentCredentials
Get-PnPProvisioningTemplate -Out "D:\Ravi\PnP\Template\pnp\template01.pnp" -PersistBrandingFiles

New-PnPTenantSite -Url "http://officedevpnp/sites/fromxmltemplate" `
                    -Title "RaviSite01" `
                    -Owner "ravi" `
                    -TimeZone 10
Connect-PnPOnline "http://officedevpnp/sites/fromxmltemplate" -CurrentCredentials
Apply-PnPProvisioningTemplate -Path "D:\Ravi\PnP\Template\pnp\template01.pnp"

#########

Connect-PnPOnline "http://officedevpnp/sites/fromxmltemplate" -CurrentCredentials
Get-PnPProvisioningTemplate -Out "D:\Ravi\PnP\Template\pnp\template02.pnp" -PersistBrandingFiles

Connect-PnPOnline "http://officedevpnp/" -CurrentCredentials
New-PnPTenantSite -Url "http://officedevpnp/sites/fromxmltemplate02" `
                    -Title "RaviSite02" `
                    -Owner "ravi" `
                    -TimeZone 10
Connect-PnPOnline "http://officedevpnp/sites/fromxmltemplate02" -CurrentCredentials
Apply-PnPProvisioningTemplate -Path "D:\Ravi\PnP\Template\pnp\template02.pnp"

#########

Connect-PnPOnline "http://officedevpnp/sites/fromxmltemplate02" -CurrentCredentials
Get-PnPProvisioningTemplate -Out "D:\Ravi\PnP\Template\pnp\template03.pnp" -PersistBrandingFiles

Connect-PnPOnline "http://officedevpnp/" -CurrentCredentials
New-PnPTenantSite -Url "http://officedevpnp/sites/fromxmltemplate03" `
                    -Title "RaviSite03" `
                    -Owner "ravi" `
                    -TimeZone 10

Connect-PnPOnline "http://officedevpnp/sites/fromxmltemplate03" -CurrentCredentials
Apply-PnPProvisioningTemplate -Path "D:\Ravi\PnP\Template\pnp\template03.pnp"

 

3 Replies

Do you also have the XML of your template?

Sorry to say but I am working on a restricted environment and can not share that with you.

But if you follow the PowerShell commands I posted you should be able to reproduce the issue.

 

When I applied the template on step #2 it creates this view. Here is the screen of the xml file where you can see additional view named "Calendar1.aspx". Once this view is there I can not apply this template. So the problem is with Apply-PnPProvisioningTemplate and not sure why it creates this view.

 

temp.png

New-PnPTenantSite -Url "http://officedevpnp/sites/fromxmltemplate" `
                    -Title "RaviSite01" `
                    -Owner "ravi" `
                    -TimeZone 10

Is an Async call. If you try to apply a template before the site creation is finished it will fail.

You can add the option -wait to make sure the site creation is finished. 

 

Regards Marc