pnpframework icon indicating copy to clipboard operation
pnpframework copied to clipboard

Bug when capturing site with applied site template

Open pkbullock opened this issue 3 years ago • 3 comments

I found an error for further investigation that when you run Get-PnPSiteTemplate this generates the following error (see below) The site has the IT help desk applied to a standard "SharePoint Team Site" with M365 Group.

Logging for future checks.

Screenshot:

image

pkbullock avatar Sep 21 '22 20:09 pkbullock

I also have this issue for collecting a template with PnP PowerShell After removing all Spacer, Divider and also the Image web part from the pages I could collect the pages. Not sure what is been done with the properties of the CanvasControl but the issue is

The JSON value could not be converted to System.Int32. Path: $.position.sectionIndex | LineNumber: 0 | BytePositionInLine: 107.
STACKTRACE:    at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& readStack, Utf8JsonReader& reader, Exception ex)
   at System.Text.Json.JsonSerializer.ReadCore(JsonSerializerOptions options, Utf8JsonReader& reader, ReadStack& readStack)
   at System.Text.Json.JsonSerializer.ReadCore(Type returnType, JsonSerializerOptions options, Utf8JsonReader& reader)
   at System.Text.Json.JsonSerializer.Deserialize(String json, Type returnType, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
   at PnP.Core.Model.SharePoint.CanvasControl.GetType(String controlDataJson)
   at PnP.Core.Model.SharePoint.Page.LoadFromHtml(String html, String pageHeaderHtml)
   at PnP.Core.Model.SharePoint.Page.<LoadPageAsync>d__126.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at PnP.Core.Model.SharePoint.Page.<LoadPagesAsync>d__98.MoveNext()
--- 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 PnP.Core.Model.SharePoint.Web.<GetPagesAsync>d__296.MoveNext()
--- 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.PageExtensions.<LoadClientSidePageAsync>d__25.MoveNext()
--- 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.PageExtensions.LoadClientSidePage(Web web, String pageName)
   at PnP.Framework.Provisioning.ObjectHandlers.Utilities.ClientSidePageContentsHelper.ExtractClientSidePage(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo, PnPMonitoredScope scope, PageToExport page)
   at PnP.Framework.Provisioning.ObjectHandlers.ObjectClientSidePageContents.ExtractObjects(Web web, ProvisioningTemplate template, ProvisioningTemplateCreationInformation creationInfo)
   at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.GetRemoteTemplate(Web web, ProvisioningTemplateCreationInformation creationInfo)
   at PnP.PowerShell.Commands.Provisioning.Site.GetSiteTemplate.ExtractTemplate(XMLPnPSchemaVersion schema, String path, String packageName, ExtractConfiguration configuration)
   at PnP.PowerShell.Commands.Provisioning.Site.GetSiteTemplate.ExecuteCmdlet()
   at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord()

PedroMordeP avatar Jan 04 '23 10:01 PedroMordeP

I think this is resolved on the PnP.Core in version 1.9, just update the references to this version

https://github.com/pnp/pnpcore/pull/1058

I updated my PnP.Framework and resolved the issue https://github.com/pnp/pnpcore/issues/1180

PedroMordeP avatar May 31 '23 11:05 PedroMordeP