In this article we will see how to apply page layout for a particular page in SharePoint 2013 using PowerShell,
$spWeb = Get-SPWeb("https://server.com/sites/MyWeb")
$spFile = $spWeb.GetFile("https://server.com/sites/Pages/MyPage.aspx")
$spFile.CheckOut("Online",$null)
$spFile.Properties["PublishingPageLayout"] = "/sites/_catalogs/masterpage/PageLayout.aspx"
$spFile.Update()
$spFile.CheckIn("Update page layout via PowerShell",[Microsoft.SharePoint.SPCheckinType]::MajorCheckIn)
$spWeb.Dispose()
Hope this helps!
$spWeb = Get-SPWeb("https://server.com/sites/MyWeb")
$spFile = $spWeb.GetFile("https://server.com/sites/Pages/MyPage.aspx")
$spFile.CheckOut("Online",$null)
$spFile.Properties["PublishingPageLayout"] = "/sites/_catalogs/masterpage/PageLayout.aspx"
$spFile.Update()
$spFile.CheckIn("Update page layout via PowerShell",[Microsoft.SharePoint.SPCheckinType]::MajorCheckIn)
$spWeb.Dispose()
Hope this helps!
Comments
Post a Comment