Apply-PnPProvisioningTemplate fails to provision the site

%3CLINGO-SUB%20id%3D%22lingo-sub-146574%22%20slang%3D%22en-US%22%3EApply-PnPProvisioningTemplate%20fails%20to%20provision%20the%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-146574%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2012.0pt%3B%20color%3A%20%23333333%3B%22%3EHere%20is%20my%20scenario%26nbsp%3Bif%20you%20keep%20creating%20a%20template%20of%20a%20site%20and%20create%20a%20site%20with%20that%20template%20it%20fails%20on%20the%20third%20occurrence%20with%20below%20message.%3C%2FP%3E%0A%3COL%20style%3D%22margin-left%3A%20.375in%3B%20direction%3A%20ltr%3B%20unicode-bidi%3A%20embed%3B%20margin-top%3A%200in%3B%20margin-bottom%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2012.0pt%3B%20font-weight%3A%20normal%3B%20font-style%3A%20normal%3B%22%20type%3D%221%22%3E%0A%3CLI%20style%3D%22margin-top%3A%200%3B%20margin-bottom%3A%200%3B%20vertical-align%3A%20middle%3B%20color%3A%20%23333333%3B%22%20value%3D%221%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2012.0pt%3B%20font-weight%3A%20normal%3B%20font-style%3A%20normal%3B%22%3ECreate%20new%20site%20for%20e.g.%20%22RaviSite01%22%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22margin-top%3A%200%3B%20margin-bottom%3A%200%3B%20vertical-align%3A%20middle%3B%20color%3A%20%23333333%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2012.0pt%3B%22%3ECreate%20copy%20of%20%22RaviSite01%22%20named%20%22RaviSite02%22%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22margin-top%3A%200%3B%20margin-bottom%3A%200%3B%20vertical-align%3A%20middle%3B%20color%3A%20%23333333%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2012.0pt%3B%22%3ECreate%20copy%20of%20%22RaviSite02%22%20named%20%22RaviSite03%22%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22margin-top%3A%200%3B%20margin-bottom%3A%200%3B%20vertical-align%3A%20middle%3B%20color%3A%20%23333333%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2012.0pt%3B%22%3EPnP%20Provisioning%20will%20fail%20to%20create%20%22RaviSite03%22%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2012.0pt%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20910px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F27051i02DDF67567F8C888%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22temp.png%22%20title%3D%22temp.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2012.0pt%3B%20color%3A%20%23333333%3B%22%3EHere%26nbsp%3Bis%20PowerShell%20script%20to%20reproduce%20the%20issue%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3EAdd-PSSnapin%20Microsoft.SharePoint.PowerShell%0A%0AConnect-PnPOnline%20%22http%3A%2F%2Fofficedevpnp%2F%22%20-CurrentCredentials%0AGet-PnPProvisioningTemplate%20-Out%20%22D%3A%5CRavi%5CPnP%5CTemplate%5Cpnp%5Ctemplate01.pnp%22%20-PersistBrandingFiles%0A%0ANew-PnPTenantSite%20-Url%20%22http%3A%2F%2Fofficedevpnp%2Fsites%2Ffromxmltemplate%22%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-Title%20%22RaviSite01%22%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-Owner%20%22ravi%22%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-TimeZone%2010%0AConnect-PnPOnline%20%22http%3A%2F%2Fofficedevpnp%2Fsites%2Ffromxmltemplate%22%20-CurrentCredentials%0AApply-PnPProvisioningTemplate%20-Path%20%22D%3A%5CRavi%5CPnP%5CTemplate%5Cpnp%5Ctemplate01.pnp%22%0A%0A%23%23%23%23%23%23%23%23%23%0A%0AConnect-PnPOnline%20%22http%3A%2F%2Fofficedevpnp%2Fsites%2Ffromxmltemplate%22%20-CurrentCredentials%0AGet-PnPProvisioningTemplate%20-Out%20%22D%3A%5CRavi%5CPnP%5CTemplate%5Cpnp%5Ctemplate02.pnp%22%20-PersistBrandingFiles%0A%0AConnect-PnPOnline%20%22http%3A%2F%2Fofficedevpnp%2F%22%20-CurrentCredentials%0ANew-PnPTenantSite%20-Url%20%22http%3A%2F%2Fofficedevpnp%2Fsites%2Ffromxmltemplate02%22%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-Title%20%22RaviSite02%22%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-Owner%20%22ravi%22%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-TimeZone%2010%0AConnect-PnPOnline%20%22http%3A%2F%2Fofficedevpnp%2Fsites%2Ffromxmltemplate02%22%20-CurrentCredentials%0AApply-PnPProvisioningTemplate%20-Path%20%22D%3A%5CRavi%5CPnP%5CTemplate%5Cpnp%5Ctemplate02.pnp%22%0A%0A%23%23%23%23%23%23%23%23%23%0A%0AConnect-PnPOnline%20%22http%3A%2F%2Fofficedevpnp%2Fsites%2Ffromxmltemplate02%22%20-CurrentCredentials%0AGet-PnPProvisioningTemplate%20-Out%20%22D%3A%5CRavi%5CPnP%5CTemplate%5Cpnp%5Ctemplate03.pnp%22%20-PersistBrandingFiles%0A%0AConnect-PnPOnline%20%22http%3A%2F%2Fofficedevpnp%2F%22%20-CurrentCredentials%0ANew-PnPTenantSite%20-Url%20%22http%3A%2F%2Fofficedevpnp%2Fsites%2Ffromxmltemplate03%22%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-Title%20%22RaviSite03%22%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-Owner%20%22ravi%22%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-TimeZone%2010%0A%0AConnect-PnPOnline%20%22http%3A%2F%2Fofficedevpnp%2Fsites%2Ffromxmltemplate03%22%20-CurrentCredentials%0AApply-PnPProvisioningTemplate%20-Path%20%22D%3A%5CRavi%5CPnP%5CTemplate%5Cpnp%5Ctemplate03.pnp%22%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-321517%22%20slang%3D%22en-US%22%3ERe%3A%20Apply-PnPProvisioningTemplate%20fails%20to%20provision%20the%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-321517%22%20slang%3D%22en-US%22%3E%3CPRE%3ENew-PnPTenantSite%20-Url%20%22http%3A%2F%2Fofficedevpnp%2Fsites%2Ffromxmltemplate%22%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-Title%20%22RaviSite01%22%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-Owner%20%22ravi%22%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-TimeZone%2010%3C%2FPRE%3E%3CP%3EIs%20an%20Async%20call.%20If%20you%20try%20to%20apply%20a%20template%20before%20the%20site%20creation%20is%20finished%20it%20will%20fail.%3C%2FP%3E%3CP%3EYou%20can%20add%20the%20option%20-wait%20to%20make%20sure%20the%20site%20creation%20is%20finished.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%20Marc%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-146739%22%20slang%3D%22en-US%22%3ERe%3A%20Apply-PnPProvisioningTemplate%20fails%20to%20provision%20the%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-146739%22%20slang%3D%22en-US%22%3E%3CP%3ESorry%20to%20say%20but%20I%20am%20working%20on%20a%20restricted%20environment%20and%20can%20not%20share%20that%20with%20you.%3C%2FP%3E%0A%3CP%3EBut%20if%20you%20follow%20the%20PowerShell%20commands%20I%20posted%20you%20should%20be%20able%20to%20reproduce%20the%20issue.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%26nbsp%3BI%20applied%20the%20template%20on%20step%20%232%20it%20creates%20this%20view.%20Here%20is%20the%20screen%26nbsp%3Bof%20the%20xml%20file%20where%20you%20can%20see%20additional%20view%20named%20%22Calendar1.aspx%22.%20Once%20this%20view%20is%20there%20I%20can%20not%20apply%20this%20template.%20So%20the%20problem%20is%20with%20Apply-PnPProvisioningTemplate%26nbsp%3Band%20not%20sure%20why%20it%20creates%20this%20view.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20822px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F27073iE17F21A029163D20%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22temp.png%22%20title%3D%22temp.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-146639%22%20slang%3D%22en-US%22%3ERe%3A%20Apply-PnPProvisioningTemplate%20fails%20to%20provision%20the%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-146639%22%20slang%3D%22en-US%22%3E%3CP%3EDo%20you%20also%20have%20the%20XML%20of%20your%20template%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New 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
Highlighted

Do you also have the XML of your template?

Highlighted

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

Highlighted
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