Requirement: SharePoint Online Set Home Page!
How to change home page in sharepoint online?
To set home page in SharePoint Online:
SharePoint Online: Change home page using PowerShell
Here is the PowerShell to set the page as a homepage in SharePoint Online.
How to change home page in sharepoint online?
To set home page in SharePoint Online:
- Navigate to Site Settings >> Click on "Welcome Page" link under "Look and Feel" group
- This takes you to the "Site Welcome Page" (/_layouts/15/AreaWelcomePage.aspx) where you can pick any existing page and set it as a welcome page or home page for your SharePoint Online site.
SharePoint Online: Change home page using PowerShell
Here is the PowerShell to set the page as a homepage in SharePoint Online.
#Load SharePoint CSOM AssembliesThis PowerShell CSOM script sets home page in SharePoint Online.
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Set Parameter Values
$SiteURL="https://crescent.sharepoint.com"
#Relative url of the homepage
$HomePageURL="SitePages/default.aspx"
#Setup Credentials to connect
$Cred = Get-Credential
$Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = $Cred
#Set welcome page
$Ctx.web.RootFolder.WelcomePage = $HomePageURL
$Ctx.web.RootFolder.Update()
$Ctx.ExecuteQuery()