SharePoint Pages Migration from SharePoint 2016 on-premises to SharePoint Online Modern Pages

Rajesh Lohar 21 Reputation points
2022-04-15T13:09:33.01+00:00

Hello,

We are migrating SharePoint 2016 on-premises to SharePoint Online. SharePoint 2016 contains publishing pages and custom page layouts. 

is there any way using PowerShell we can migrate and modernize the all the publishing pages and other classic pages to SharePoint Online modern pages?

Thanks,

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. sadomovalex 3,636 Reputation points
    2022-04-15T14:08:03.363+00:00

    didn't try it by myself but there is PnP Page Transformation tool which you may try. Check the following post: Can I convert a Publishing page to the modern experience. And also MS document Transform classic pages to modern pages.

    0 comments No comments

  2. Rajesh Lohar 21 Reputation points
    2022-04-18T06:40:47.82+00:00

    Thanks @sadomovalex . I tried it but getting error as "ConvertTo-PnPPage : could not find file PnP.Framework.resources"

    I am not sure what is missing.

    Thanks,

    0 comments No comments

  3. Tong Zhang_MSFT 9,251 Reputation points
    2022-04-18T09:07:56.113+00:00

    Hi anonymous user,
    According to my research and testing, you can install SharePoint Migration Tool to do the migration. And you can use the following PowerShell script to migrate pages from SharePoint 2016 to SharePoint Online:

    $SourceSiteUrl = "http://sp/sites/xxx"  
    $OnPremUserName = "xxx\xxxx"  
    $OnPremPassword = ConvertTo-SecureString -String "<<PassWord>>" -AsPlainText -Force  
    $SPCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $OnPremUserName, $OnPremPassword  
    $SourceListName = "xxx"  
      
    #Define SharePoint target#  
    $SPOUrl = "https://xxxxx.sharepoint.com/sites/xxxx"  
    $UserName = "******@xxxxx.onmicrosoft.com"  
    $PassWord = ConvertTo-SecureString -String "<<PassWord>>" -AsPlainText -Force  
    $SPOCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $UserName, $PassWord  
      
    #Import SPMT Migration Module#  
    Import-Module Microsoft.SharePoint.MigrationTool.PowerShell  
      
    #Register the SPMT session with SharePoint credentials#  
    Register-SPMTMigration -SPOCredential $SPOCredential -Force  
      
    #Add two tasks into the session. One is SharePoint migration task, and another is File Share migration task.#  
    Add-SPMTTask -SharePointSourceCredential $SPCredential -SharePointSourceSiteUrl $SourceSiteUrl  -TargetSiteUrl $SPOUrl -MigrateAll  
      
      
    #Start Migration in the console. #  
    Start-SPMTMigration  
    

    My test results:
    193789-image.png 193778-image.png

    Use the following PowerShell script to convert all classic pages to modern pages:

    #Set Parameters  
    $SiteURL="https://xxxxx.sharepoint.com/sites/xxxxx"  
       
    #Connect to Site  
    Connect-PnPOnline $SiteURL -Credentials (Get-Credential)  #-Interactive  
       
    #Get All Pages from "Site Pager" Library  
    $Pages = Get-PnPListItem -List SitePages -PageSize 500  
       
    ForEach($Page in $Pages)  
    {  
        #Get the page name  
        $PageName = $Page.FieldValues.FileLeafRef  
        Write-host "Converting Page:"$PageName  
       
        #Check if the page is classic  
        If($Page.FieldValues["ClientSideApplicationId"] -eq "b6917cb1-93a0-4b97-a84d-7cf49975d4ec")  
        {  
            Write-host "`tPage is already Modern:"$PageName -f Yellow  
        }  
        Else  
        {  
            #Conver the classic page to modern page  
            ConvertTo-PnPPage -Identity $PageName -Overwrite -TakeSourcePageName -AddPageAcceptBanner  
            Write-host "`tPage Converted to Modern!" -f Green      
        }  
    }  
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.


    0 comments No comments

  4. Rajesh Lohar 21 Reputation points
    2022-04-18T12:34:29.337+00:00

    Thanks for the above script.
    Will it work with publishing site and publishing pages?

    Thanks,

    0 comments No comments

  5. Rajesh Lohar 21 Reputation points
    2022-04-18T13:15:06.7+00:00

    Hi,

    I tried migration pages from SharePoint 2016 to SharePoint Online using SPMT Powershell, but it gave me an error as "The SharePoint version '0' is not supported". It seems it does not support SharePoint 2016.

    Also I have few publishing sites and custom page layout. Please advise if those will be migrated and converted to Modern pages?

    Thanks,

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.