errors when using Get-PnPProvisioningTemplate

%3CLINGO-SUB%20id%3D%22lingo-sub-67552%22%20slang%3D%22en-US%22%3Eerrors%20when%20using%20Get-PnPProvisioningTemplate%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-67552%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20site%20collection%20admin%20on%20a%20site%20and%20I%20run%20Get-SPOProvisioningTemplate%20and%20it%20works%20until%20the%20process%20starts%20to%20get%20the%20web%20parts%20XML%20and%20then%20I%20get%20this%20%3A-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24error%5B0%5D.Exception.Stacktrace%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20at%20System.Net.HttpWebRequest.GetResponse()%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20at%20Microsoft.SharePoint.Client.PageExtensions.GetWebPartXml(Web%20web%2C%20Guid%20webPartId%2C%20String%20serverRelativePageUrl)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20at%20OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectPageContents.GetFileContents(Web%20web%2C%20ProvisioningTemplate%20template%2C%20String%20welcomePageUrl%2C%20ProvisioningTemplateCreationInformation%20creationInfo%2C%20PnPMonitoredScope%20scope)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20at%20OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectPageContents.ExtractObjects(Web%20web%2C%20ProvisioningTemplate%20template%2C%20ProvisioningTemplateCreationInformation%20creationInfo)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20at%20OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.GetRemoteTemplate(Web%20web%2C%20ProvisioningTemplateCreationInformation%20creationInfo)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20at%20SharePointPnP.PowerShell.Commands.Provisioning.GetProvisioningTemplate.ExtractTemplate(XMLPnPSchemaVersion%20schema%2C%20String%20path%2C%20String%20packageName)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20at%20SharePointPnP.PowerShell.Commands.Provisioning.GetProvisioningTemplate.ExecuteCmdlet()%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20at%20SharePointPnP.PowerShell.Commands.SPOCmdlet.ProcessRecord()%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20error%20I%20get%20is%20a%20403%20error%20!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBTW%20this%20happens%20on%20the%20couple%20of%20sites%20I%20have%20tried.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnybody%20any%20ideas%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENigel%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-67558%22%20slang%3D%22en-US%22%3ERe%3A%20errors%20when%20using%20Get-PnPProvisioningTemplate%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-67558%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F4102%22%20target%3D%22_blank%22%3E%40Nigel%20Price%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20assume%20that%20the%20pages%20are%20checked%20in%2C%20published%20etc.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20run%20the%20Get-PnPProvisioningTemplate%20with%20Set-PnPTraceLog%20and%20%26nbsp%3Binlcude%20a%20few%20lines%20before%20you%20get%20the%20error%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECould%20you%20give%20some%20more%20information%20about%20which%20web%20parts%20are%20on%20the%20page%3FMaybe%20we%20screenshot%20of%20the%20Web%20Part%20Maintenance%20page%20would%20help%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Regular Contributor

Hi

 

I am site collection admin on a site and I run Get-SPOProvisioningTemplate and it works until the process starts to get the web parts XML and then I get this :-

 

$error[0].Exception.Stacktrace
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.SharePoint.Client.PageExtensions.GetWebPartXml(Web web, Guid webPartId, String serverRelativePageUrl)
   at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectPageContents.GetFileContents(Web web, ProvisioningTemplate template, String welcomePageUrl, ProvisioningTemplateCreationInformation creationInfo, PnPMonitoredScope scope)
   at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectPageContents.ExtractObjects(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo)
   at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.GetRemoteTemplate(Web web, ProvisioningTemplateCreationInformation creationInfo)
   at SharePointPnP.PowerShell.Commands.Provisioning.GetProvisioningTemplate.ExtractTemplate(XMLPnPSchemaVersion schema, String path, String packageName)
   at SharePointPnP.PowerShell.Commands.Provisioning.GetProvisioningTemplate.ExecuteCmdlet()
   at SharePointPnP.PowerShell.Commands.SPOCmdlet.ProcessRecord()

 

The error I get is a 403 error !

 

BTW this happens on the couple of sites I have tried.

 

Anybody any ideas ?

 

Thanks

 

Nigel

1 Reply
Highlighted

Hi @Nigel Price,

 

I assume that the pages are checked in, published etc.

 

Can you run the Get-PnPProvisioningTemplate with Set-PnPTraceLog and  inlcude a few lines before you get the error?

 

Could you give some more information about which web parts are on the page?Maybe we screenshot of the Web Part Maintenance page would help