Apr 11 2023 03:49 AM - edited Apr 14 2023 07:29 AM
I am migrating SharePoint from on-premises to on-line. The process has copied lots of pages over which are in the classic mode and I want to convert them to modern. I really don't have time to recreate them all so I was hoping I could find some automated method.
I am not a programmer. I don't know how to use .Net and I can't write programs in PowerShell.
All I can see so far is lots of obscure and arcane PowerShell (why have we gone back to the 80s?) but I've been working through it and tried a script which uses ConvertTo-PnPPage but it didn't work, possibly because it's been superseded. I found a suggestion that I should use PnP.PowerShell instead of the old tools (I think - there are a lot of different instructions with little explanation) so I tried that but when I do
Register-PnPManagementShellAccess
I get an error:
Register-PnPManagementShellAccess : The 'Register-PnPManagementShellAccess' command was found in the module 'PnP.PowerShell', but the module could not be loaded. For more information, run 'Import-Module PnP.PowerShell'.
At line:1 char:1
+ Register-PnPManagementShellAccess
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Register-PnPManagementShellAccess:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
If I do what it says I just get another error message:
Import-Module : Could not load file or assembly 'System.Management.Automation, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
At line:1 char:1
+ Import-Module PnP.PowerShell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
My preference would be to find a way to do this via the admin pages or some other GUI method but if I have to use scripts is there a decent explanation of how to get it to work somewhere?
Apr 11 2023 05:59 AM
Apr 11 2023 07:43 AM - edited Apr 14 2023 07:27 AM
Apr 11 2023 07:43 AM - edited Apr 14 2023 07:27 AM
That's where I find myself getting bogged down. I'm just an admin, I'm not a programmer.
The script from the Microsoft page just gets me a different error message: "List 'sitepages' does not exist at site"
Apr 12 2023 12:55 AM
@An_admin_123 Try installing latest version of PnP PowerShell and then use ConvertTo-PnPPage cmdlet.
Follow documentations:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
Apr 14 2023 07:32 AM
Apr 16 2023 10:11 PM
@An_admin_123 Can you show us the complete PowerShell code you are using currently?
Did you check in "Site Contents" of site for "Site Pages" library? Is it available on your SharePoint site?
If yes and you are referring to library using title/display name anywhere in your code, try using "Site Pages" instead of "SitePages".
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
Apr 18 2023 12:21 PM
Apr 19 2023 01:30 AM
@An_admin_123 Document library display name and internal name (URL name) can be different in SharePoint. So, use this:
$pages = Get-PnPListItem -List "Site Pages" -PageSize 500
Where there is a space in display name of list/library, you have to enclose it inside double quotes as shown above.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
Apr 19 2023 12:40 PM