pnpframework icon indicating copy to clipboard operation
pnpframework copied to clipboard

ConvertTo-PnPPage : Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

Open Cheridbell2 opened this issue 2 years ago • 1 comments

I am migrating from Classic sites to Modern sites and I am trying to change the Home Page to Modern. This is the error message - -the script is simple: $SiteURL="https://xxxx.sharepoint.com/sites/xxxx" $ClassicPageName = "home.aspx"

Connect-PnPOnline $SiteURL -Interactive

ConvertTo-PnPPage -Identity $ClassicPageName -AddPageAcceptBanner

Can you please assist?

Cheridbell2 avatar Jun 16 '22 17:06 Cheridbell2

Hello @Cheridbell2 ,

Can you try if it works with the PnP.Core Solution for this.

Example:

$SiteURLTarget="https://xxxx.sharepoint.com/sites/xxxx"
$SiteURLSource="https://xxxx.sharepoint.com/sites/xxxx"
$ClassicPageName = "home.aspx"

$targetConnection = Connect-PnPOnline $SiteURLTarget -ReturnConnection

Connect to the source site
Connect-PnPOnline $SiteURLSource

Trigger transformation
Invoke-PnPTransformation -Identity $ClassicPageName -TargetConnection $targetConnection

Url: https://pnp.github.io/pnpcore/using-the-sdk/transformation-getting-started.html

danielpastoor avatar Jun 22 '22 09:06 danielpastoor