SharePoint replace root site - How to replace root site in SharePoint Online from Microsoft 365 Admin Center

SharePoint Online Replace Root Site: How To Do?

No comments

Loading

In this SharePoint Online replace root site article, we will learn about how to replace the root site in SharePoint online from the Microsoft 365 (Office 365) admin center. This option was not available earlier, I would say this is a huge improvement towards a better intranet for the user. With this addition, we can have our own custom branded site, later on, we can convert the branded site to a tenant root site.

Introduction: What is Root Site in SharePoint Online?

The root site in SharePoint Online is the top-level site in a SharePoint site collection. It serves as the primary entry point and central hub for accessing and organizing other subsites, lists, libraries, and content within the site collection. The root site is often configured as the main intranet homepage for an organization and plays a key role in the overall structure and navigation of SharePoint environments.

Key Characteristics of the Root Site

  1. Top-Level Site
    • The root site is at the top of the hierarchy in a site collection.
    • It is located at the base URL of the site collection (e.g., yourdomain.sharepoint.com).
  2. Central Hub
    • Acts as the central hub for accessing various subsites, documents, lists, and other resources within the site collection.
    • Often used to provide a unified interface and central location for organizational resources.
  3. Customization and Branding
    • Can be customized and branded to reflect the organization’s identity, including logos, themes, and navigation.
    • Often serves as the main intranet site, providing news, announcements, and important links.
  4. Permissions and Security
    • Permissions set at the root site level can be inherited by subsites and content within the site collection.
    • Allows centralized management of security and access controls.
  5. Home for Shared Resources
    • Commonly houses shared resources such as document libraries, lists, and content that need to be accessed by a wide audience within the organization.
    • Used for storing policies, procedures, templates, and other critical organizational documents.

Key Components of the Root Site

  1. Home Page
    • The landing page that users see when they navigate to the root URL of the site collection.
    • Can include web parts for news, events, quick links, and other information relevant to the organization.
  2. Site Navigation
    • Provides navigation menus and links to help users find and access different areas of the site collection.
    • Includes top navigation bars and quick launch bars for easy access to subsites and content.
  3. Document Libraries
    • Centralized libraries for storing and sharing documents, which can be accessed by users across the organization.
    • Supports versioning, metadata, and collaboration features.
  4. Lists
    • Used to store and manage data, such as announcements, contacts, tasks, and calendars.
    • Lists can be customized with different views, columns, and forms.
  5. Subsites
    • Additional sites created within the site collection to organize content and resources by department, project, or team.
    • Each subsite can have its own permissions, design, and structure.

Common Uses of the Root Site

  1. Intranet Portal
    • The root site is often configured as the organization’s intranet portal, providing a central location for news, announcements, and resources.
    • Used to disseminate information and facilitate communication across the organization.
  2. Corporate Dashboard
    • A dashboard providing key metrics, reports, and analytics relevant to the organization.
    • Can include web parts for displaying charts, graphs, and other visual data.
  3. Document Management
    • Central repository for important documents, policies, and procedures.
    • Facilitates document sharing, collaboration, and version control.
  4. Collaboration Hub
    • Serves as a starting point for team collaboration, providing access to team sites, project sites, and other collaborative spaces.
    • Supports tools like Microsoft Teams and OneDrive for Business.

For example, for any subscription when we create a tenant for SharePoint Online – the default root site URL would be in the below format:

Format: "tenantname.sharepoint.com"
Example: "globalsharepoint2020.sharepoint.com"

For this demo, I have created another communication site as – “globalsharepoint2020.sharepoint.com/sites/home”, we are going to replace the site with a tenant root site – meaning after replacing if the user types the “globalsharepoint2020.sharepoint.com”, the new home site will be opened.

Please see the below screenshot, where we have shown two sites:

  1. “globalsharepoint2020.sharepoint.com” – tenant current root site
  2. “globalsharepoint2020.sharepoint.com/sites/home” – future root site
SharePoint replace root site - Replace root site in SharePoint Online tenant
Replace root site in SharePoint Online tenant

SharePoint Online Replace Root Site: How Do I Replace?

Following are the steps to replace the root site in the SharePoint admin center:

Assume that you have a global administrator or SharePoint administrator role for your tenant and have opened the SharePoint admin center URL.

Note:

  • Admin Center URL – “globalsharepoint2020-admin.sharepoint.com/_layouts/15/online/AdminHome.aspx#/siteManagement/view/ALL%20SITES”

Step1: Select your current root site as shown below.

Step 2: Click on the three dots (…) in the menu.

Step 3: Click on the “Replace site” link from the dropdown list.

Replace site in SharePoint admin center
Replace the site in the SharePoint admin center

Step to pass the site URL parameter – URL of the site you want to use

In the next right-side panel we will get the “Replace root site” configuration page where it will be mentioned in the below text:

“Specify a different site to use as the root (top-level) site for your organization. The site you select must be a team site or communication site. It can’t be a hub site or connected to a Microsoft 365 Group.”

Replace site in SharePoint admin center process
Replace site in SharePoint admin center process

Then we need to pass the below parameter:

  • URL of the site you want to use, example: “globalsharepoint2020.sharepoint.com/sites/home”

Note:

  • We will see the message like the current site will be moved to “globalsharepoint2020.sharepoint.com/sites/archive-2021-05-25T112415Z”

Step to check the site validation

Here the tool will check whether this site can be replaced as a new root site – internally it will check all prerequisites to become a root site, if everything goes well, we will see this message “This site can be used as the root site – site validation” in green colour which indicates that the site is ready for the swap.

This site can be used as the root site - site validation
This site can be used as the root site – site validation

Click on the “Save” button.

Note

  • The current root site will be moved to “globalsharepoint2020.sharepoint.com/sites/archive-2021-05-25T112415Z”

Immediately on the next screen, we will see the status message as “Replacing root site” (as shown below).

SharePoint replace root site - Replacing root site in progress in SharePoint Online admin center
Replacing root site in progress in SharePoint Online admin center

Now we could see that no more the old root site is in an active state – now it has been archived (as shown below).

Old root site has been archived after replacing it in SharePoint Online admin center
The old root site has been archived after replacing it in the SharePoint Online admin center

Now onwards if you browse your tenant root site it will be redirected to the new root site.

Now, we will show you a couple of screenshots.

Before swapping the site the new home site was as below:

SharePoint Online home site before swapping
SharePoint Online home site before swapping

After swapping the site – refresh the same page, we will be redirected to the tenant root site URL as below:

SharePoint Online tenant root site after swapping
SharePoint Online tenant root site after swapping

The old tenant root site has been archived after the swapping as shown below:

SharePoint Online tenant root site has been archived after swapping
SharePoint Online tenant root site has been archived after swapping

How to swap the root site in SharePoint Online using PowerShell?

The swap whatever we have using the Microsoft 365 admin tool (SharePoint Online Administration) user interface, we can do the same swapping of the root site using the below PowerShell script in SharePoint Online:


####The below script is used to swap the old root site to new home root site.

cls

$PSshell = Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorVariable err -ErrorAction SilentlyContinue
if($PSshell -eq $null)
{
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

$fileName = "SwapRootSiteUsingPowerShell"

#'yyyyMMddhhmm yyyyMMdd
$enddate = (Get-Date).tostring("yyyyMMddhhmmss")
$logFileName = $fileName +"_"+ $enddate+"_Log.txt"
$invocation = (Get-Variable MyInvocation).Value
$directoryPath = Split-Path $invocation.MyCommand.Path

$directoryPathForLog=$directoryPath+"\"+"LogFiles"
if(!(Test-Path -path $directoryPathForLog))
{
New-Item -ItemType directory -Path $directoryPathForLog
#Write-Host "Please Provide Proper Log Path" -ForegroundColor Red
}

$logPath = $directoryPathForLog + "\" + $logFileName

$isLogFileCreated = $False

function Write-Log([string]$logMsg)
{
if(!$isLogFileCreated){
Write-Host "Creating Log File..."
if(!(Test-Path -path $directoryPath))
{
Write-Host "Please Provide Proper Log Path" -ForegroundColor Red
}
else
{
$script:isLogFileCreated = $True
Write-Host "Log File ($logFileName) Created..."
[string]$logMessage = [System.String]::Format("[$(Get-Date)] - {0}", $logMsg)
Add-Content -Path $logPath -Value $logMessage
}
}
else
{
[string]$logMessage = [System.String]::Format("[$(Get-Date)] - {0}", $logMsg)
Add-Content -Path $logPath -Value $logMessage
}
}

 

#Paramaters area
$adminSiteURL="globalsharepoint2020-admin.sharepoint.com"
$sourceSiteURL="globalsharepoint2020.sharepoint.com/sites/Home"
$targetURL="globalsharepoint2020.sharepoint.com"
$archiveURL="globalsharepoint2020.sharepoint.com/sites/archive-2021-05-25T112415Z"
$userName = "YourSPOUserName"
$passWord = "YourSPOPassword"
$encPassWord = convertto-securestring -String $passWord -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $encPassWord

#Paramaters area - Ends

try
{

Connect-SPOService -Url $adminSiteURL

#Command Syntax

#Invoke-SPOSiteSwap -SourceURl "yourdomain.sharepoint.com/sites/home" -TargetURL "yourdomain.sharepoint.com" -ArchiveUrl "yourdomain.sharepoint.com/sites/archivedhome"

#Command example
Invoke-SPOSiteSwap -SourceUrl $sourceSiteURL -TargetUrl $targetURL -ArchiveUrl $archiveURL

Write-Host "The site has been swapped Successfully" -BackgroundColor Green


}
catch
{

$ErrorMessage = $_.Exception.Message +"in swapping the site!:"
Write-Host $ErrorMessage -BackgroundColor Red
Write-Log $ErrorMessage

}

Here the “Invoke-SPOSiteSwap” command does the job, the syntax of the command is as below:


Invoke-SPOSiteSwap -SourceURl "yourdomain.sharepoint.com/sites/home" -TargetURL "yourdomain.sharepoint.com" -ArchiveUrl "yourdomain.sharepoint.com/sites/archivedhome"

Notes:

  • The account that is executing the script should be a global administrator.
  • The home site must be a modern communication site.
  • The SharePoint Online Management Shell must be installed in the machine where you are executing the script – it can be downloaded from here.

SharePoint Replace Root Site: General Use Cases of Swapping of Root Site in SharePoint Online

Let’s say you have created a new modern communication site where you did a lot of customization in order to align with your company’s policy or in the existing modern communication site you have done the customization and that site you want to represent as your company’s home site – then we can make use of the swapping functionality.

Summary: SharePoint Replace Root Site

Thus, in this article, we have learned the below with respect to swapping the root site in SharePoint Online:

  • In 2 steps replace/swap the root site in SharePoint Online using Microsoft 365 and PowerShell.
  • How to replace the root site in SharePoint Online from Microsoft 365?
  • How to swap the root site in SharePoint Online from Microsoft 365?
  • How to swap the root site in SharePoint Online from Microsoft 365?
  • How to swap the root site in SharePoint Online using the PowerShell command/script.
  • How to use the “Invoke-SPOSiteSwap” command in SharePoint Online?
  • Use cases of swapping of root site in SharePoint Online

See Also: SharePoint Online PowerShell Tutorials

You may also like the following SharePoint PowerShell tutorials:

 

About Post Author

Do you have a better solution or question on this topic? Please leave a comment