Pnpframework: [BUG] Convert-PublishingPages script run successfully with converting pages to modern pages

Created on 5 Feb 2021  路  5Comments  路  Source: pnp/pnpframework

Convert-PublishingPages.ps1 is not working and not giving any logs

[x] Page Transformation: Error during the use of page transformation from PnP PowerShell

Excepted Behavior

Is to have publishing pages converted from the source site to the target site

Observed Behavior

The script run successfully without any error but pages haven't converted to modern pages in the target site

Steps to Reproduce

Run this script Convert-PublishingPages.ps1

Submission Guidelines

page transformation 馃 question

All 5 comments

Hi @mohammadamer ,

Please provide some more details:

  • Which version of PnP PowerShell did you use?
  • Is the source site in SPO or SharePoint On-premises?

Would recommend to try to convert 1 page to start by manually calling ConvertTo-PnPPage (or ConvertTo-PnPClientSidePage if you're using an older version of PnP PowerShell) and see what that gives. Here's a sample cmdlet execution that transforms a single publishing page into a modern page in another site:

ConvertTo-PnPClientSidePage -PublishingPage -Identity somepage.aspx -Overwrite -TargetWebUrl https://contoso.sharepoint.com/sites/targetsite -KeepPageCreationModificationInformation -PostAsNews -LogType File -LogVerbose -LogFolder c:\temp 

If that throws an error please share the produced log. If not please capture a Fiddler trace and share it.

Hi Bert,

I am using PnP.PowerShell
PnP.PowerShell 1.2.14
PnP.PowerShell 1.2.0

SPO
SharePoint Online Publishing Site to SharePoint Online Communication Site

I'll try a single page as per your recommendation. I'll update you.

Thanks for your quick response

Hi Bert,

I would say that the above line of power shell worked convert very simple classic page to Modern Page.
But when it comes to Convert-PublishingPages.ps1, I am trying to make it work :)

Some more details
When I run (Convert-PublishingPages.ps1) using -UseWebLogin , nothing happened. I figured out that it was permission issue although I have rights on both sites.
When I run (Convert-PublishingPages.ps1) using Azure AD APP , For some reasons it can't find the library name in the source although the library is present in the source.

Get-PnPListItem : No list found with id, title or url 'Page Library Name'

Well, the key thing is that you can achieve what you need via calling ConvertTo-PnPPage (or ConvertTo-PnPClientSidePage which is the old name)...based upon above feedback that seems to be the case. What the Convert-PublishingPages.ps1 script does is loop over the pages in the source site and call ConvertTo-PnPPage...so to check things I would recommend the following:

  • switch to using -Interactive instead of -UseWebLogin for authentication. See https://pnp.github.io/powershell/articles/authentication.html#setting-up-access on how to configure access via the PnP Management Shell Azure AD app
  • Connect to the site hosting the pages to convert (so the source site) and check that Get-PnPListItem -List "Pages" -Connection $sourceConnection -PageSize 500 does list the pages you want to get converted. Note that if your site is localized the list might not be named Pages but something else.

Closing this one and continuing this via #167

Was this page helpful?
0 / 5 - 0 ratings