powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[BUG] Error when running ConvertTo-PNPPage on a classic page with Image under /_layouts

Open remcodegroot opened this issue 3 years ago • 1 comments
trafficstars

Notice

Many bugs reported are actually related to the PnP Framework which is used behind the scenes. Consider carefully where to report an issue:

Reporting an Issue

I'm trying to convert classic to modern pages using ConvertTo-PNPPage\

Expected behavior

A succesful conversion of the classic page to a modern page.

Actual behavior

ConvertTo-PnPPage fails with "Page does not exist" if an image is on the page that is not in a library. (Like the default : /sites//_layouts/images/homepageSamplePhoto.jpg). When you download this image and place it in a library and modify the link on the classic page to point to /sites//_layouts/SiteAssets/homepageSamplePhoto.jpg then the migration succcedes.

An error log with verbose logging in the attachment.

I have tried to exclude SharePointPnP.Modernization.WikiImagePart from the webpart mapping and to use -SkipDefaultUrlRewriting . Both did not help.

Steps to reproduce behavior

ConvertTo-PnPPage -Identity "Home1" -Overwrite -LogVerbose -LogType File -WebPartMappingFile .\webpartmapping.xml

or

ConvertTo-PnPPage -Identity "Home1" -Overwrite -LogVerbose -LogType File -WebPartMappingFile .\webpartmapping.xml -SkipDefaultUrlRewriting

What is the version of the Cmdlet module you are running?

1.10.0

Which operating system/environment are you running PnP PowerShell on?

  • [X ] Windows
  • [ ] Linux
  • [ ] MacOS
  • [ ] Azure Cloud Shell
  • [ ] Azure Functions
  • [ ] Other : please specify

Page-Transformation-Report-20-4-2022-10-40-12.md

remcodegroot avatar Apr 20 '22 08:04 remcodegroot

Found what the cause is: It is caused by the Function ImageLookup({ServerRelativeFileName}) Since for these files no library is found the function crashes. It would be enough if a place holder could be placed or even if the image was skipped.

remcodegroot avatar Apr 20 '22 11:04 remcodegroot

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Dec 24 '22 02:12 github-actions[bot]

@remcodegroot - Can you please update to the latest release 2.1.x however you will need PS 7.2 or later to benefit from all the bug fixes and improvements.

PS5 support has been dropped in the new release.

Feel free to reopen if the issue persists. Thanks!

veronicageek avatar Apr 11 '23 12:04 veronicageek