SharePoint 2010: This page does not use a valid page layout

SharePoint 2010 I have a wiki site that I exported and imported from one farm to another. However, I exported it from the root site of the site collection to an additional site in another site collection. When I look at any page created using the Enterprise wiki template, I get an error message:

This page does not use a valid page layout. To fix the problem, edit the page settings and select a valid page layout.

The page layout is displayed as the base page. And it works fine for newly created pages. How can I fix the page layout, i.e. on existing pages?

Any thoughts?

+3
source share
3

. , . . PowerShell.

+1

Mahesh Blog MS " " . ( , -, , SharePoint 2007 XsltListViewWebPart GroupBy).

0

/ , , ( , )

[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);
      }
  }

}
0

Source: https://habr.com/ru/post/1785098/


All Articles