How to modernize a classic site other than team site on SharePoint online

rameez hasan 6 Reputation points
2022-09-15T04:45:35.393+00:00

Hi,

I have couple of site collections on my tenant which are created based on different classic templates like Document center, eDiscovery Center, Blank Site, Project Web App Site, Publishing Site , Project Site etc.

we have a requirement to convert all these sites to modern sites. For Teams classic site there is a powershell script to update a site to modern site but for any other template I could not find any Powershell script like that. I want to avoid recreation of these sites as modern site followed by Content migration.

Please let me know if there is a way to update all the non -Teams sites mentioned above to modern site.

Microsoft 365 and Office | SharePoint Server | For business
Microsoft 365 and Office | SharePoint | For business | Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Jinwei Li-MSFT 4,736 Reputation points Microsoft External Staff
    2022-09-15T08:01:45.907+00:00

    Hi @rameez hasan ,

    It is not supported to convert the entire classic site to modern site.
    But you could convert classic page to modern page using PowerShell.

    Convert a Classic Page to Modern Page:

    $SiteURL=https://xxx.sharepoint.com/sites/xxx  
    $ClassicPageName = "home.aspx"  
      
    #Connect to Site  
    Connect-PnPOnline $SiteURL -Interactive  
      
    #Convert Classic page to Modern page  
    ConvertTo-PnPPage -Identity $ClassicPageName -AddPageAcceptBanner  
    

    241435-image.png

    Convert All Classic Pages to Modern Page:

    #Set Parameters  
    $SiteURL=https://xxx.sharepoint.com/sites/xxx  
      
    #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       
        }  
    }  
    

    241398-image.png
    Note: Don’t forget to replace the parameters with your own.


    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.


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.