pnp / pnpframework

PnP Framework is a .NET library targeting Microsoft 365 containing the PnP Provisioning engine and a ton of other useful extensions
https://pnp.github.io/pnpframework/
MIT License
202 stars 140 forks source link

Get-PnPSiteTemplate with -PersistBrandingFiles switch leads to "File Not Found" #647

Open MichaelJata opened 2 years ago

MichaelJata commented 2 years ago

Hi, I could narrow down the issue I am facing. When generating the Site Template, it all works until I use the PersistBrandingFiles flag. In this case, the following errors are traced whereas the last one is repeated a lot of times until the script stops eventually.

pwsh Warning: 0 : 2022-04-27 11:24:07.3402 [Client Side Page Contents] [23] [Information] Error during automatic client side page connected file export: The property or field 'ServerRelativeUrl' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.. 28117ms edf30961-42e5-45f4-9edd-4a91713ad81e pwsh Error: 0 : 2022-04-27 11:24:07.3962 [PnP.Framework] [0] [Error] ExecuteQuery threw following exception: Microsoft.SharePoint.Client.ServerException: File Not Found. at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream) at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse() at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb) at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync() at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync() at Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync() at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent) ServerErrorCode: -2147024894 ServerErrorTypeName: System.IO.FileNotFoundException ServerErrorTraceCorrelationId: 29c837a0-e0c3-4000-130a-bf08056881e0 ServerErrorValue: ServerErrorDetails: . 0ms pwsh Warning: 0 : 2022-04-27 11:24:07.3963 [Client Side Page Contents] [23] [Information] Error during automatic client side page connected file export: File Not Found.. 28173ms edf30961-42e5-45f4-9edd-4a91713ad81e pwsh Error: 0 : 2022-04-27 11:24:07.4620 [PnP.Framework] [0] [Error] ExecuteQuery threw following exception: Microsoft.SharePoint.Client.ServerException: File Not Found. at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream) at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse() at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb) at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync() at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync() at Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync() at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent) ServerErrorCode: -2147024894 ServerErrorTypeName: System.IO.FileNotFoundException ServerErrorTraceCorrelationId: 29c837a0-d0c6-4000-130a-b16293dc70ba ServerErrorValue: ServerErrorDetails: . 0ms pwsh Warning: 0 : 2022-04-27 11:24:07.4627 [Client Side Page Contents] [23] [Information] Error during automatic client side page connected file export: File Not Found.. 28239ms edf30961-42e5-45f4-9edd-4a91713ad81e pwsh Error: 0 : 2022-04-27 11:24:07.5151 [PnP.Framework] [0] [Error] ExecuteQuery threw following exception: Microsoft.SharePoint.Client.ServerException: File Not Found. .... .... I have tried both, authentication with app only (certificate) and interactive with no difference.

1.10.0 PnP.PowerShell

Get-PnPSiteTemplate -Out $templatefileName -Connection $sourceConnection -PersistPublishingFiles -IncludeAllPages -IncludeSiteGroups -IncludeNativePublishingFiles -PersistBrandingFiles -Force

Get-PnPSiteTemplate: File Not Found.

It results in not generating the template file.

frupprecht-nC commented 2 years ago

I am facing the same issue. Did you find a workaround or a solution?