Question

When i create sharepoint site with powershell:

$siteNomenclaturesURL =  "$holidaysSite/Nomenclatures"

New-SPWeb $siteNomenclaturesURL 
-Template "CMSPUBLISHING#0" 
-Name "Noms"  
-UseParentTopNav -Language 1026

$SPWebNomenclatures = Get-SPWeb -Identity $siteNomenclaturesURL 

I want to checkin welcome page for this webSite:

/Nomenclatures/Pages/default.aspx

Was it helpful?

Solution

$spWeb=Get-SPWeb "SiteURL"

$folder = $spWeb.RootFolder

$pageURL=$folder.WelcomePage

$page = $spWeb.GetFile($pageUrl);

if ($page.CheckedOutBy.UserLogin -eq $spWeb.CurrentUser.UserLogin)
{

$page.CheckIn("Page checked in automatically by PowerShell script")

$page.Publish("Published")

}

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top