[英]SharePoint 2010: This page is not using a valid page layout
SharePoint 2010我有一個企業wiki站點,我從一個服務器場導出並導入到另一個服務器場。 但是,我將其從網站集根網站導出到另一個網站集中的子網站。 當我瀏覽到使用Enterprise wiki模板創建的任何頁面時,我收到錯誤:
此頁面未使用有效的頁面布局。 要解決此問題,請編輯頁面設置並選擇有效的頁面布局。“
頁面布局顯示為基本頁面。 並且適用於創建的新頁面。 如何修復現有頁面中的頁面布局?
有什么想法嗎?
原來這是一個錯誤。 如果導入發布網站,則頁面沒有指向頁面布局的正確鏈接。 無法通過UI解決此問題。 我不得不使用PowerShell 。
我按照Mahesh的博客來閱讀這篇MS Support文章,並使用“管理內容和結構”工具來更改頁面布局。 非常奇怪(此錯誤似乎是來自無法從SharePoint 2007升級並且具有無效GroupBy設置的XsltListViewWebPart的頁面的下游錯誤)。
下面是復制鏈接中代碼的更簡單/類似版本,以防原始文件消失(我添加了關於需要更改的內容的說明)
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Publishing")
$web = Get-SPWeb -Identity "http://web/you/are/modifying"; #Change web that you're modifying on this line
$spPubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web);
$pages = $spPubWeb.PagesList;
foreach($item in $pages.Items)
{
$pubPage = [Microsoft.SharePoint.Publishing.PublishingPage]::GetPublishingPage($item)
$url = new-object Microsoft.SharePoint.SPFieldUrlValue($pubPage.ListItem[[Microsoft.SharePoint.Publishing.FieldId]::PageLayout].ToString())
if($url -ne $null)
{
if($url.Url -match 'NameOfPageLayout') #Change Page layout name on this line
{
$newurl = new-object Microsoft.SharePoint.SPFieldUrlValue("http://new/rootweb/_catalogs/masterpage/NewPageLayout.aspx, NewPageLayoutName") #Change URL and name on this line
$pubPage.Name
$pubPage.CheckOut()
$pubPage.ListItem[[Microsoft.SharePoint.Publishing.FieldId]::PageLayout] = $newurl
$pubPage.ListItem.UpdateOverwriteVersion()
$pubPage.ListItem.File.CheckIn("Fixed URL to page layout.", [Microsoft.SharePoint.SPCheckinType]::MajorCheckIn);
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.