简体   繁体   English

SharePoint 2010:此页面未使用有效的页面布局

[英]SharePoint 2010: This page is not using a valid page layout

SharePoint 2010 I have an enterprise wiki site, that I exported and imported from one farm to another. SharePoint 2010我有一个企业wiki站点,我从一个服务器场导出并导入到另一个服务器场。 However, I exported it form a site collection root site, to a sub site in another site collection. 但是,我将其从网站集根网站导出到另一个网站集中的子网站。 When I browse to any page that was created with the Enterprise wiki template, I get the error: 当我浏览到使用Enterprise wiki模板创建的任何页面时,我收到错误:

This page is not using a valid page layout. 此页面未使用有效的页面布局。 To correct the problem, edit page settings and select a valid page layout." 要解决此问题,请编辑页面设置并选择有效的页面布局。“

The page layout is showing as Basic Page. 页面布局显示为基本页面。 And works ok for new pages created. 并且适用于创建的新页面。 How can I fix the page layout, that is in the existing pages? 如何修复现有页面中的页面布局?

Any thoughts? 有什么想法吗?

Turns out it's a bug. 原来这是一个错误。 If you import a publishing site, the pages do not have the correct link to the page layout. 如果导入发布网站,则页面没有指向页面布局的正确链接。 No way to fix this through the UI. 无法通过UI解决此问题。 I had to use PowerShell . 我不得不使用PowerShell

I followed Mahesh's Blog to this MS Support article and used the Manage Content and Structure tool to change the Page Layout. 我按照Mahesh的博客来阅读这篇MS Support文章,并使用“管理内容和结构”工具来更改页面布局。 Quite strange (this error seems to be a downstream error from a page that failed to upgrade from SharePoint 2007 and had a XsltListViewWebPart which had an invalid GroupBy setting). 非常奇怪(此错误似乎是来自无法从SharePoint 2007升级并且具有无效GroupBy设置的XsltListViewWebPart的页面的下游错误)。

Below is a simpler /similar version of the code in the link copied in case the original goes away (I've added notes about what needs to be changed) 下面是复制链接中代码的更简单/类似版本,以防原始文件消失(我添加了关于需要更改的内容的说明)

[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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM