errors when using Get-PnPProvisioningTemplate

Regular Contributor



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 :-


   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 ?





1 Reply

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