Wednesday, February 8, 2017

SharePoint Online: How to Change Home Page using PowerShell

Requirement:  SharePoint Online Set Home Page!

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
    SharePoint Online Set Home Page
  • 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 powershell set home page
This changes welcome 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.
#Load SharePoint CSOM Assemblies
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()
This PowerShell CSOM script sets home page in SharePoint Online.



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!


You might also like:

Related Posts Plugin for WordPress, Blogger...