pnp / pnp/pnpframework

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

Open
#647 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
259
Forks
161
Avg merge
10h 33m
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Get-PnPSiteTemplate handling of -PersistBrandingFiles and the automatic client side page connected file export described in the report. Reproduce the command shown, then trace the ServerRelativeUrl error and repeated File Not Found responses. Done means the template is generated without those errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.