Setup home site SharePoint - How to set up home site in SharePoint Online using PowerShell?

Setup home site SharePoint: How to set up home site in SharePoint Online using PowerShell?

One comment

Loading

In this “Setup home site SharePoint” article, we will learn about how to set up a home site in SharePoint Online using the PowerShell script.

What you will learn from this article?

  • Introduction to home site app in SharePoint Online
  • Capabilities of Home Site in SharePoint Online
  • Set up a home site for your organization using the PowerShell script

Introduction to home site app in SharePoint Online: Setup home site SharePoint

The home site feature is newly introduced by Microsoft where we can design a more sophisticated user-friendly community site that can be used as a landing page for all users in your intranet. We can have news, events, embedded video and conversations, and other resources to deliver an engaging experience that reflects your organization’s voice, priorities, and brand, and it must be a modern communication site.

Capabilities of Home Site in SharePoint Online: Setup home site SharePoint

  • The home site is easily accessible both from the SharePoint mobile app (Android and iOS). All users that have access to the home site will see a home button on the Find tab of the mobile app. Homesites are designed to be mobile-friendly from the start as the site is built based on the communication site template.
  • Search for the site is scoped to global – meaning it can be searched from all sites within the organization.
  • The site is automatically set up as an organization news site (what is an organization news site will discuss later in another article).
  • On the in-home site, we can configure the global navigation in the SharePoint app bar.
  • In Homesite, we can use the Viva Connections (we will write a separate article on viva connections)
  • Once the site has been converted into a home site – it becomes a SharePoint home site app.
  • The SharePoint home site can be configured as an app inside Microsoft Teams.

Set up a home site for your organization using the PowerShell script

Using the below PowerShell script, we can convert a modern communication site to the home site:


####The below script is used to convert the modern communication site to a home site.

cls

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

$fileName = "ConvertToHomeSiteUsingPowerShell"

#'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="https://globalsharepoint2020-admin.sharepoint.com"
$homeSiteURL="https://globalsharepoint2020.sharepoint.com/sites/Home"
#Paramaters area - Ends

try
{

Connect-SPOService -Url $adminSiteURL

#Command Syntax
#Set-SPOHomeSite -HomeSiteUrl 

#Command example
Set-SPOHomeSite -HomeSiteUrl $homeSiteURL
Write-Host "The site has been converted to a home site Successfully" -BackgroundColor Green


}
catch
{

$ErrorMessage = $_.Exception.Message +"in converting to home site!:"
Write-Host $ErrorMessage -BackgroundColor Red
Write-Log $ErrorMessage

}

Notes:

  • The account that runs the script should be a global administrator role.
  • The home site should be a modern communication site.

SharePoint home site examples – Setup home site SharePoint

After executing the script, if we navigate to the home site URL, we can see the below screen:

There click on the gear icon from the top right corner link.

Setup home site SharePoint - Set up home site app for your organization in SharePoint Online
Set up a home site app for your organization in SharePoint Online

From the site settings, under the SharePoint section, we can see the “Global navigation” link to configure which indicates that this is a home site app – this was not there before converting or running the script.

Note:

The global navigation link from the SharePoint site settings page indicates that this is a home site and a modern communication site can be converted to a home site only using the PowerShell command – as of today, there is no option in the SharePoint Online Admin Center tool where we can do this conversion.

Summary: What do we have here (Setup home site SharePoint)?

Thus, in this article, we have learned the below with respect to setting up the home site in SharePoint Online:

  • Introduction to home site app in SharePoint Online
  • Capabilities of Home Site in SharePoint Online
  • Set up a home site for your organization using the PowerShell script
  • SharePoint home site examples
  • How to set up a landing site for your organization on the intranet using the SharePoint Online home site app
  • How to configure the home site app in SharePoint Online tenant?

See Also: SharePoint PowerShell

You may also like the following SharePoint PowerShell tutorials:

Buy the premium version of SharePoint Online & Office 365 administration eBook from here:


Buy SharePoint Online & Office 365 Administration eBook

About Post Author

1 comments on “Setup home site SharePoint: How to set up home site in SharePoint Online using PowerShell?”

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