Skip to content

Instantly share code, notes, and snippets.

@beckettkev
Created May 13, 2015 19:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save beckettkev/88a7347d6dc6c7c8d63d to your computer and use it in GitHub Desktop.
function Set-WelcomePage
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true, Position=1)]
$clientContext,
[Parameter(Mandatory=$true, Position=2)]
$web,
[Parameter(Mandatory=$true, Position=3)]
[string]$welcomePageUrl
)
process
{
Write-Host "Setting welcome page to $welcomePageUrl" -foregroundcolor black -backgroundcolor yellow
$clientContext.Load($web)
$rootFolder = $web.RootFolder
$clientContext.Load($rootFolder)
$clientContext.ExecuteQuery()
$rootFolder.WelcomePage = $welcomePageUrl
$rootFolder.Update()
$clientContext.ExecuteQuery()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment