Hi guys, I seem to have run into yet another minor issue. I've been able to convert 18507 pages from a set of several sites and subsites and now only 10 are failing. The problem seems to be with pages that contain table tags with empty <tbody>. See description below.
I greatly appreciate your help so far!
[X] Bug
[ ] Enhancement
[ ] Page Transformation: Error during the setup/use of the Page Transformation UI solution (did you check our troubleshooting guide?)
[X] Page Transformation: Error during the use of page transformation from PnP PowerShell
[ ] Page Transformation: Error during the use of page transformation from .Net
[ ] Page Transformation: Page is not looking correct after transformation
[ ] Modernization Scanner: something went wrong...
Certain types of html content relating to the <table> tag throws exceptions.
Adding this to a publishing html field, that is in turn converted to WikiTextPart seems to cause the error. It does not have to be the only html in the field to trigger it.
<table>
<tbody>
</tbody>
</table>โโโโโโโโ<br/>
or
<table cellspacing="0" cellpadding="0" width="640" border="0">
<tbody>
<tr>
<td height="124">โ </td>
<td valign="top" colspan="3" rowspan="2">
<p>
<font face="Arial, Helvetica, sans-serif" size="3">...โโโ</font></p>
</td>
</tr>
</tbody>
</table>โ<br/>
The exception thrown to the console:
Error: [Web Part Mapping] An error occurred processing functions - Exception has been thrown by the target of an invocation. Error: Exception has been thrown by the target of an invocation. StackTrace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at SharePointPnP.Modernization.Framework.Functions.BaseFunctionProcessor.ExecuteMethod(Object functionClassInstance, FunctionDefinition functionDefinition, MethodInfo methodInfo)
at SharePointPnP.Modernization.Framework.Functions.FunctionProcessor.ExecutePropertyFunctions(String[] functionsToProcess, WebPart webPartData, WebPartEntity webPart, Property property)
at SharePointPnP.Modernization.Framework.Functions.FunctionProcessor.Process(WebPart& webPartData, WebPartEntity webPart)
at SharePointPnP.Modernization.Framework.Transform.ContentTransformator.Transform(List`1 webParts)
Error: [Summary] A critical error occurred - transformation did not complete Error: Exception has been thrown by the target of an invocation. StackTrace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at SharePointPnP.Modernization.Framework.Functions.BaseFunctionProcessor.ExecuteMethod(Object functionClassInstance, FunctionDefinition functionDefinition, MethodInfo methodInfo)
at SharePointPnP.Modernization.Framework.Functions.FunctionProcessor.ExecutePropertyFunctions(String[] functionsToProcess, WebPart webPartData, WebPartEntity webPart, Property property)
at SharePointPnP.Modernization.Framework.Functions.FunctionProcessor.Process(WebPart& webPartData, WebPartEntity webPart)
at SharePointPnP.Modernization.Framework.Transform.ContentTransformator.Transform(List`1 webParts)
at SharePointPnP.Modernization.Framework.Publishing.PublishingPageTransformator.Transform(PublishingPageTransformationInformation publishingPageTransformationInformation)
Exception from Get-PnPException:
CorrelationId : b3b32b9f-e066-2000-3d41-3a96c93cda5b
TimeStampUtc : 15.01.2020 11:56
Message : Invalid URI: The format of the URI could not be determined.
Stacktrace : at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at Microsoft.SharePoint.Client.ClientContextExtensions.Clone(ClientRuntimeContext clientContext, String siteUrl, Dictionary`2 accessTokens)
at SharePointPnP.PowerShell.Commands.ClientSidePages.ConvertToClientSidePage.ExecuteCmdlet()
at SharePointPnP.PowerShell.Commands.PnPCmdlet.ProcessRecord()
<table>
<tbody>
</tbody>
</table>โโโโโโโโ<br/>
$sourceConnection = Connect-PnPOnline -Url [sourceUrl] -ReturnConnection
$sourceConnection = Connect-PnPOnline -Url [targetUrl] -ReturnConnection
$mapping = [path to mapping file]
ConvertTo-PnPClientSidePage -Identity [page id] `
-PublishingPage `
-Overwrite `
-Connection $sourceConnection `
-TargetConnection $targetConnection `
-DisablePageComments `
-LogType Console `
-LogVerbose `
-PageLayoutMapping $mapping
Page layout mapping file:
<PublishingPageTransformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.dev.office.com/PnP/2019/03/PublishingPageTransformationSchema" Version="1.0.1907.0">
<PageLayouts>
<PageLayout Name="ArticlePage" AssociatedContentType="Page" PageLayoutTemplate="AutoDetect" PageHeader="Custom">
<Header Type="FullWidthImage" Alignment="Left" ShowPublishedDate="false">
<Field Name="PublishingPageImage;PublishingRollupImage" HeaderProperty="ImageServerRelativeUrl" Functions="ToImageUrl({@name})" />
<Field Name="ArticleByLine" HeaderProperty="TopicHeader" />
<Field Name="PublishingContact" HeaderProperty="Authors" Functions="ToAuthors({PublishingContact})" />
</Header>
<MetaData>
<Field Name="Title" TargetFieldName="Title" />
</MetaData>
<WebParts>
<Field Name="PublishingPageContent" TargetWebPart="SharePointPnP.Modernization.WikiTextPart" Row="2" Column="1" Order="1">
<Property Name="Text" Type="string" Functions="TextCleanup({PublishingPageContent})" />
</Field>
</WebParts>
</PageLayout>
</PageLayouts>
</PublishingPageTransformation>
SharePointPnPPowerShellOnline version:
Major Minor Build Revision
----- ----- ----- --------
3 17 2001 1
Thanks for the detailed error report @rudfoss, I'll get this fixed for the next release. 10 failing out of 18507 is quite good, but I really appreciate you reporting this as this way we can make page transformation even more reliable
No problem @jansenbe. Happy to contribute! Just hope I'm not causing you too much extra work. This is a very low prioirty issue for me so please don't feel any pressure to resolve this quickly. I'm just happy the tool exists and is as flexible as it is.
I'm unsure if it's related to this, but I'm getting exceptions when pages contain links to local images that do not exist on the source or target. E.g.: /images/layout2/tom.gif (referring to a non existent folder or file) I seem to be getting the same exception from Get-PnPException as I do with the table issue.
@rudfoss: I've improved table migration reliability, will be included in the February release.
@rudfoss: also fixed the issue with the missing image, when someone deleted the source image while it was referenced on a page the transformation failed. Will also be part of the February release.
I'll close this issue, but feel free to open a new issue if things are still failing with the upcoming February release.