You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have just installed the latest version of PnP.PowerShell and am getting the following error?
Error : The 'ConvertTo-PnPClientSidePage' command was found in the module 'PnP.PowerShell', but the module could not be loaded. For more information, run 'Import-Module PnP.PowerShell'.
# Connect to the web holding the pages to modernize
#Install-Module -Name "PnP.PowerShell"
Import-Module PnP.PowerShell
try {
$SiteUrl = "https://<tenant>.sharepoint.com/sites/teamsite"
$sourcePageName = $false
$folderLocation = $(Get-Location)
Connect-PnPOnline -Url $SiteUrl -Interactive
sleep 5
try {
Write-Host "Enabling the modern page feature." -ForegroundColor Green
Enable-PnPFeature -Identity "B6917CB1-93A0-4B97-A84D-7CF49975D4EC" -Scope Web -Force
} catch {}
$pages = Get-PnPListItem -List SitePages -PageSize 500
Write-Host "Starting the modernization." -ForegroundColor Green
Foreach($page in $pages) {
$pageName = $page.FieldValues["FileLeafRef"]
if ($page.FieldValues["ClientSideApplicationId"] -eq "b6917cb1-93a0-4b97-a84d-7cf49975d4ec") {
Write-Host -foregroundcolor Yellow ""
$page.FieldValues["FileLeafRef"]
" is a modern page."
} else {
Write-Host "Converting $($pageName) to modern page" -ForegroundColor Cyan
ConvertTo-PnPClientSidePage -Identity $page.FieldValues["ID"] `
-Overwrite ` - TakeSourcePageName: $sourcePageName `
-LogType File ` - LogFolder $folderLocation `
-LogSkipFlush ` - KeepPageCreationModificationInformation `
-CopyPageMetadata
}
}
Write-Host "The conversion log file." -ForegroundColor Green
Save-PnPClientSidePageConversionLog
Write-Host "Successfully converted to modern pages." -ForegroundColor Green
Disconnect-PnPOnline
}
catch {
Write-Host -ForegroundColor Red 'Error ', ':' $Error[0].ToString();
sleep 10
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have just installed the latest version of PnP.PowerShell and am getting the following error?
Error : The 'ConvertTo-PnPClientSidePage' command was found in the module 'PnP.PowerShell', but the module could not be loaded. For more information, run 'Import-Module PnP.PowerShell'.
Powershell version: 7.1.5
PnP.Powershell: 1.8.0
Any ideas how I get around this?
Beta Was this translation helpful? Give feedback.
All reactions