pnp / pnp/pnpframework

Page transformation failing with ConvertTo-PnPPage, failing for the pages which has images/icons)

Open
#792 0 comments 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

Hello All,

I am using PNP Powershell 1.12 and Powershell 7.

I am doing the page transformation from 2013 on-premise to SharePoint online modern site. The SharePoint 2013 has custom page layouts. I am using the below commands to do the transformation.

$sp13Conn = Connect-PnPOnline https://xxx.yyy.org/ -TransformationOnPrem -CurrentCredentials -ReturnConnection
$spOnlineConn = Connect-PnPOnline https://xyz.sharepoint.com/sites/abc -Interactive -ReturnConnection

ConvertTo-PnPPage -Identity "Coin-Exchange-Program.aspx" -PublishingPage  -TargetConnection $spOnlineConn -Connection $sp13Conn -PageLayoutMapping "C:\Temp\custompagelayoutmapping-modified.xml" -LogVerbose -LogType File -LogFolder "C:\Logs"

The above ConvertTo-PnpPage works for simple pages which has Text but its failing for the pages which has images or icons etc.

i do see Mutiple errors depending on the page I am transforming, one of the errors is

_'0x0A' is invalid within a JSON string. The string should be correctly escaped. Path: $ | LineNumber: 0 | BytePositionInLine: 83. at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable1 actualByteCount) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 json, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at PnP.Core.Model.SharePoint.PageWebPart.set_PropertiesJson(String value)
at PnP.Framework.Modernization.Transform.ContentTransformator.Transform(List`1 webParts)
at PnP.Framework.Modernization.Publishing.PublishingPageTransformator.Transform(PublishingPageTransformationInformation publishingPageTransformationInformation)

Attached is the log file and the custom page layout mapping file

Page-Transformation-Report-11-16-2022-12-51-14-PM.md
custompagelayoutmapping-modified.xml.txt

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 with the ConvertTo-PnPPage command and the attached Page-Transformation-Report and custompagelayoutmapping-modified.xml files. Reproduce the transformation from SharePoint 2013 using a page containing images or icons, then trace the reported PropertiesJson failure. Done means the affected pages transform successfully without the invalid JSON error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
content
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.