Quantcast
Channel: Ryan Clark, Author at Mr. SharePoint
Viewing all articles
Browse latest Browse all 256

How to Modernize Your Root Site in SharePoint Online (2023)

$
0
0

Tired of your classic root site?

In this guide, you will learn two methods you can use to modernize the root site of your SharePoint tenant.

Let’s get started.

What is a root site?

A root site in SharePoint Online is the uppermost site in the hierarchy of a SharePoint environment.

It acts as the gateway to the organization’s SharePoint experience.

It’s the default site users reach when accessing the SharePoint domain, usually at the tenant’s base URL.

https://[yourdomain].sharepoint.com.

It’s more than a landing page — it’s a central hub for organizing and accessing resources, subsites, and shared content across your organization.

Think of it as the foundation of your SharePoint house, supporting and connecting all other rooms (subsites).

Related: SharePoint Start Page vs Home Site vs Hub Site vs Root Site

How to Modernize the Root Site

Modernizing the root site in SharePoint Online involves several steps and considerations. Here’s a detailed guide on how to do it: 

Considerations and Limitations

Before you start the modernization process, it’s important to understand its implications and limitations:

  1. Backup: Ensure you have a backup of your current root site. This is crucial in case you need to revert to the original site due to unforeseen issues.
  2. Customizations: Be aware that some customizations in your classic root site may not work in the modern experience.
  3. Site address: The root site’s address stays the same after the swap, while the source site’s address changes to something like “https://contoso.sharepoint.com/sites/archive.”
  4. Site usage data: The site usage data will not be swapped. The usage data will stay with the original sites.
  5. Microsoft 365 group: If the source site is connected to a Microsoft 365 group, the group will not be swapped. The group will stay with the original site.
  6. Search: The search index will be reset for both sites. It may take some time for search results to be updated after the swap.
  7. SharePoint home sites: If your root site is a home site, you must remove the home site designation before swapping it with another site.
  8. Hub sites: If your root site or source site is a hub site, you will need to unregister it as a hub site before you can swap it.
  9. Site designs: If a site design is applied to the source site, you must manually apply it to the root site after the swap.

For the process, you have two options:

  • Create a replacement modern site and swap it out with the current root site
  • Create a temporary replacement site and transform the classic root site into a modern site

Step 1: Prepare the replacement site

The first step is to replace it with a modern communication site or a modern team site that is not connected to a Microsoft 365 group.

Get into the SharePoint admin center first:

  • App launcher > admin
  • Expand all options > SharePoint
admin button from the app launcher

Expand options and select SharePoint

If you already have a ready-to-use site, you can proceed directly to step #2 of this guide.

Otherwise:

  • Go to sites > active sites
  • Click the create button
Active sites > Create

You will then have choices on the type of site to create as a stand-in root site (if you don’t have any yet).

Just click on your choice and create the new site:

create a new site: select the site type

Step 2: Replace the root site

Once you have the replace site, you will need to find the root site from the active sites page.

If you don’t know the site name, you can simply find it by looking for the site with a URL that’s the same as the tenant.

That could be https://mrsharepointguru.sharepoint.com.

finding the root sharepoint site in the active sites page

Select that site and then click the replace site button on the command bar.

From there, enter the URL of the replacement site and click the save button:

url of the site you want to use

Now, here’s what’s going to happen:

  • If the replacement site (new root site) is specifically created to “replace” the classic root site, then you can stop here.
  • But if you want to transform the classic site into a modern site, you will need to proceed with the next steps.

Step 3: Convert to a modern site

The next part is about using PowerShell commands.

For this step, make sure that:

  • You have the latest PnP PowerShell
  • Run Windows PowerShell ISE as administrator
opening powershell as an admin

From there, you simply need to copy the commands.

Here they are:

<# 

.Synopsis

    Converts all classic wiki and web part pages in a site. 
    You need to install PnP PowerShell version 3.16.1912.* (December 2019) or higher to use this script.

    Sample includes:
        - Conversion of wiki and web part pages
        - Connecting to MFA or supplying credentials
        - Includes Logging to File, log flushing into single log file        

.Example

    Convert-WikiAndWebPartPages.ps1 -SourceUrl "https://contoso.sharepoint.com/sites/classicteamsite" -TakeSourcePageName:$true

.Notes
    
    Useful references:
        - https://aka.ms/sppnp-pagetransformation
        - https://aka.ms/sppnp-powershell
#>

[CmdletBinding()]
param (

    [Parameter(Mandatory = $true, HelpMessage = "Url of the site containing the pages to modernize")]
    [string]$SourceUrl,

    [Parameter(Mandatory = $false, HelpMessage = "Modern page takes source page name")]
    [bool]$TakeSourcePageName = $false,    

    [Parameter(Mandatory = $false, HelpMessage = "Supply credentials for multiple runs/sites")]
    [PSCredential]$Credentials,

    [Parameter(Mandatory = $false, HelpMessage = "Specify log file location, defaults to the same folder as the script is in")]
    [string]$LogOutputFolder = $(Get-Location)
)
begin
{
    Write-Host "Connecting to " $SourceUrl
    
    if($Credentials)
    {
        Connect-PnPOnline -Url $SourceUrl -UseWebLogin
        Start-Sleep -s 3
    }
    else
    {
        Connect-PnPOnline -Url $sourceUrl -SPOManagementShell -ClearTokenCache
        Start-Sleep -s 3
    }
}
process 
{    
    Write-Host "Ensure the modern page feature is enabled..." -ForegroundColor Green
    Enable-PnPFeature -Identity "B6917CB1-93A0-4B97-A84D-7CF49975D4EC" -Scope Web -Force

    Write-Host "Modernizing wike and web part pages..." -ForegroundColor Gree
    # Get all the pages in the site pages library. 
    # Use paging (-PageSize parameter) to ensure the query works when there are more than 5000 items in the list
    $pages = Get-PnPListItem -List sitepages -PageSize 500

    Write-Host "Pages are fetched, let's start the modernization..." -ForegroundColor Green
    Foreach($page in $pages)
    { 
        $pageName = $page.FieldValues["FileLeafRef"]
        
        if ($page.FieldValues["ClientSideApplicationId"] -eq "b6917cb1-93a0-4b97-a84d-7cf49975d4ec" ) 
        { 
            Write-Host "Page " $page.FieldValues["FileLeafRef"] " is modern, no need to modernize it again" -ForegroundColor Yellow
        } 
        else 
        {
            Write-Host "Processing page $($pageName)" -ForegroundColor Cyan
            
            # -TakeSourcePageName:
            # The old pages will be renamed to Previous_.aspx. If you want to 
            # keep the old page names as is then set the TakeSourcePageName to $false. 
            # You then will see the new modern page be named Migrated_.aspx

            # -Overwrite:
            # Overwrites the target page (needed if you run the modernization multiple times)
            
            # -LogVerbose:
            # Add this switch to enable verbose logging if you want more details logged

            # KeepPageCreationModificationInformation:
            # Give the newly created page the same page author/editor/created/modified information 
            # as the original page. Remove this switch if you don't like that

            # -CopyPageMetadata:
            # Copies metadata of the original page to the created modern page. Remove this
            # switch if you don't want to copy the page metadata

            ConvertTo-PnPClientSidePage -Identity $page.FieldValues["ID"] `
                                        -Overwrite `
                                        -TakeSourcePageName `
                                        -LogType File `
                                        -LogFolder $LogOutputFolder `
                                        -LogSkipFlush `
                                        -KeepPageCreationModificationInformation `
                                        -CopyPageMetadata
        }
    }

    # Write the logs to the folder
    Write-Host "Writing the conversion log file..." -ForegroundColor Green
    Save-PnPClientSidePageConversionLog

    Write-Host "Wiki and web part page modernization complete! :)" -ForegroundColor Green
}
end
{
    Disconnect-PnPOnline
}

After that, you will need to enter the URL of the site (it has the word ‘archive’ in it) and your username and password.

You will then receive a notice that the modernization is complete (the time it takes will depend on the site’s size:

modernization complete from powershell ise

That’s it!

Check the site and its pages first to confirm (the new modern pages start with ‘Migrated_’ including the home page).

Related: SharePoint Modern Pages: How to Transform Classic Sites

Step 4: Return the root site

From there, all you have to do is repeat step #3.

But this time, you need to replace the replacement site with the now modernized (original) root site collection.

url of the site you want to use

Modernizing Your Root Site

While the process of modernizing your root site in SharePoint Online may seem complex, it is a worthwhile task.

Plan carefully, address challenges, and provide user training for the new modern site, as with any major change.

Do you have more questions regarding modernizing root sites in SharePoint Online? Feel free to share your thoughts.

For business inquiries, please use the site’s contact form to get in touch, and I’ll get back to you as soon as possible.

The post How to Modernize Your Root Site in SharePoint Online (2023) appeared first on Mr. SharePoint.


Viewing all articles
Browse latest Browse all 256

Trending Articles