PowerShell でカスタム ページレイアウトを追加して適用すると、サーバー上でのみ機能するように見えます。ページを外部から開こうとすると、空白のコンテンツ ページが表示されます (masterpage は機能します)。私が取り組んでいるサイトでは、公開機能が有効になっています。適用に使用する PowerShell コード:
$urlSiteRel = /sites/TheSiteName
$PageLayoutRelUrl = "$urlSiteRel/_catalogs/masterpage/MyPortalLayout.aspx"
# Get the Page URL
$PageName = "Portal.aspx"
# Get the Title of the Page which is going to get created
$PageTitle = "My Portal"
# Initialize the Site Object
$Site = Get-SPSite($urlSite)
# Get the Publishing Site based on the SPSite
$PubSite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($Site)
# Get the SPWeb Object
$Web = Get-SPWeb $urlSite
# Initialize the PublishingWeb based on the SPWeb
$PubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($Web)
# Get the PageLayouts Installed on the Publishing Site
$Layouts = $PubSite.GetPageLayouts($False)
# Get our PageLayout
$PageLayout = $Layouts[$PageLayoutRelUrl]
# Create a new publishing page.
$Page = $PubWeb.AddPublishingPage($PageName, $PageLayout)
# Assign the Title for the Page
$Page.Title = $PageTitle
# Update the Page
$Page.Update();
# Check in the Page with Comments
$Page.CheckIn("Checkedin")
# Publish the Page With Comments
$Page.ListItem.File.Publish("Published")