question

HarishPatil-9672 avatar image
0 Votes"
HarishPatil-9672 asked EchoDu-MSFT edited

Convert classic home page to modern home page

Hi Team,


I am trying below code to convert classic page to modern page. But getting below error.

Kindly suggest the resolution for the same.


Code:

$modernPage = ConvertTo-PnPClientSidePage -Identity $page.FieldValues["FileLeafRef"] -Overwrite


Error: The 'ConvertTo-PnPClientSidePage' command was found in the module 'SharePointPnPPowerShellOnline', but the module could not be loaded. Fo
r more information, run 'Import-Module SharePointPnPPowerShellOnline'.


Thanks,

Harish Patil

office-sharepoint-online
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @HarishPatil-9672 ,

Would you tell me whether your issue has been resolved or have any update?

Have a nice day!

0 Votes 0 ·
ElsieLu-MSFT avatar image
0 Votes"
ElsieLu-MSFT answered

Hi @HarishPatil-9672 ,

Per my test, you could follow these steps:
Download SharePoint online management shell

Then run the command:

 Install-Module SharePointPnPPowerShellOnline

And connect your site:

 #Connect to the classic site with pages to modernize  
 Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/teamsite  

Like this:
83936-1.jpg

Then run this command, you will see a new modern page, and then set it to Home page:

 ConvertTo-PnPClientSidePage -Identity Home.aspx -AddPageAcceptBanner  

83972-2.jpg

Reference:
Transform Classic SharePoint Pages To Modern Look And Feel

Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1.jpg (70.2 KiB)
2.jpg (104.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

UkoTan-7888 avatar image
0 Votes"
UkoTan-7888 answered

I would validate the pnp module already loaded. Are you running a compatible version of PNP powershell with respect to the native powershell modules?

PS> get-module | fl *

Try reloading the PNP powershell directly from nuget

PS> Install-PackageProvider Nuget -force
PS> Update-Module -Name PowerShellGet -Force
PS> Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
PS> Install-Module SharePointPnpPowerShellOnline

HTH

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.