Open pmatthews05 opened 5 years ago
Can you repro this when you create a new site collection and then try to apply the template? If so then please share the template used
Due to company policy, and the size of the template, I have created a brand new template to show this issue.
I have created a new site collection called /sites/otbPnPIssue. I created a couple of site columns, a content type, a list and assigned the content type to the list.
I then got the template by using get-pnpprovisioningtemplate using the latest schema.
I then created a new site collection called /sites/ptbPnPIssue2 (spelling mistake there doh!) Then after this site collection was created, I called apply-pnpprovisioiningtemplate using the .xml from the get-pnprovisioningtemplate.
I have attached the xml, please rename back to pnpissue.xml. pnpissue.xml.txt
As stated previously, the provisioning still happens, but when you have PnpTraceLog set to debug, you get the error message.
I am, and have been, experiencing the same issue. The error occurs regardless of PNP Powershell version.
@pmatthews05 Have you solved your problem yet? I'm experiencing the same issue as you did, though I'm using pnp in c# but not powershell. If you have solved it, it would be greatly appreciated if you can share your solution.
I'm also have the issue. Working with 3.4.1812.2 When it starts with extracting "Page Contents". Underneath the 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.ExtractObjects(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo) at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.GetRemoteTemplate(Web web, ProvisioningTemplateCreationInformation creationInfo) at SharePointPnP.PowerShell.Commands.Provisioning.Site.GetProvisioningTemplate.ExtractTemplate(XMLPnPSchemaVersion schema, String path, String packageName) at SharePointPnP.PowerShell.Commands.Provisioning.Site.GetProvisioningTemplate.ExecuteCmdlet() at SharePointPnP.PowerShell.Commands.PnPCmdlet.ProcessRecord()
Upgraded to latest version. Error still occurs. Name Version
SharePointPnPPowerShell2016 3.5.1901.0 SharePointPnPPowerShellOnline 3.5.1901.0
I'm also have the issue. Working with 3.4.1812.2 When it starts with extracting "Page Contents". Underneath the 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.ExtractObjects(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo) at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.GetRemoteTemplate(Web web, ProvisioningTemplateCreationInformation creationInfo) at SharePointPnP.PowerShell.Commands.Provisioning.Site.GetProvisioningTemplate.ExtractTemplate(XMLPnPSchemaVersion schema, String path, String packageName) at SharePointPnP.PowerShell.Commands.Provisioning.Site.GetProvisioningTemplate.ExecuteCmdlet() at SharePointPnP.PowerShell.Commands.PnPCmdlet.ProcessRecord()
We're experiencing the exact same issue and exception. Cmdlet used: Get-PnPProvisioningTemplate
Any solution yet? I found out that, when removing all webparts from the homepage, the script ends well. Adding a webpart and than extracting causes an error. But I don't know how to solve it. It is very important that my template has the correct homepage, not an empty one....
Eventually, I found the solution. I had the onprem and cloud PNP installed side side. Name Version
SharePointPnPPowerShell2016 3.9.1905.0 SharePointPnPPowerShellOnline 3.9.1905.0
Uninstalling SharePointPnPPowerShell2016 made it work without errors.
I have only SharePointPnPPowerShellOnline module (no onpremise) but I still get the error when using Apply-PnPProvisioningTemplate
Get-Module sharepoint*
ModuleType Version Name ExportedCommands
Binary 3.8.1904.0 SharePointPnPPowerShellOnline {Add-PnPAlert, Add-PnPApp, Add-PnPClientSidePage, Add-PnPClientSidePageSection...}
powershell.exe Error: 0 : 2019-05-14 12:20:56.5644 [OfficeDevPnP.Core] [0] [Error] ExecuteQuery threw following exception: System.Net.WebException: The remote server returned an error: (403) Forbidden.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func
2 endFunction, Action1 endAction, Task
1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.SPWebRequestExecutor.1.FromAsyncCoreLogic(IAsyncResult iar, Func
2 endFunction, Action1 endAction, Task
1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.SPWebRequestExecutor.
I have below as well Set-PnpTraceLog -Level Debug -On
Regards, Sukesh
Category
[x] Bug [ ] Enhancement
Environment
[x] Office 365 / SharePoint Online [ ] SharePoint 2016 [ ] SharePoint 2013
Provisioning a XML template using PNP Powershell. Although the template continues, there is an error stating "System.Net.WebException: The remote server returned an error: (403) Forbidden."
Observed Behavior
Using the latest PNP Powershell Version: 3.2.1810.0 I'm just trying to apply a template to my Team site. It doesn't matter what the template is, or what it is trying to do. This happens if you export a template and then try to import it again.
Steps to reproduce.
Powershell I'm using to create:
The process starts off, it trys to connect, and then you get a 403 error, but then it continues.