Archive

Archive for June, 2014

SharePoint Page Layouts and Site Templates “The object specified does not belong to a list.”

SharePoint Version: SharePoint 2010, SharePoint 2013

Ever try and update the available page layouts for a site and get the following error:

 

“The object specified does not belong to a list.”

 

The chances are some page layout got deleted or corrupt and is blowing up this page. The following PowerShell will set the site so all page layouts are available and can get you past this issue.

 

<#
Reset site to use all page layouts
#>

param
(
    #required params
    [string]$webName  = $(throw "webName parameter not specified"),
    [string]$resetsubsites  = $(throw "resetsubsites parameter not specified")
)

if (-not (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue))
{
    Add-PSSnapin Microsoft.SharePoint.PowerShell
}
 
$web = Get-SPWeb $webName;
 
if ([Microsoft.SharePoint.Publishing.PublishingWeb]::IsPublishingWeb($web))
{
    $spPub = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
    $spPub.IsAllowingAllPageLayouts # check to see if it is already set
    $spPub.AllowAllPageLayouts($false) #Set it to allow all page layouts
    $spPub.Update()
}
else
{
    Write-Host $webName is not a publishing web.
}
 
$web.Dispose();

Advertisements
Categories: SharePoint Tags: ,