Thursday, September 3, 2015

Fix "The site is not valid. The 'Pages' document library is missing" Error

After trying to deactivate and activate the publishing feature in a site, users started receiving this error: "The site is not valid. The 'Pages' document library is missing". It also happened after importing a subsite backup! Additionally, when tried creating a Publishing Pages they got this error:

The site is not valid. The 'Pages' document library is missing.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.SharePoint.Publishing.InvalidPublishingWebException: The site is not valid. The 'Pages' document library is missing.

Fix "The site is not valid. The 'Pages' document library is missing" Error
Root Cause: 
SharePoint Publishing feature stores the ID of the "Pages" library in the "__PagesListId" property  of SPWeb property bag. If this property doesn't match with the current "Pages" library, then we get this error! Made sure publishing feature is active and tried de-activate and activate the publishing feature once again. Didn't help.

To fix this error, We'll have to set the "__PagesListId" property on the affected web's property bag!

PowerShell Script to Update the Pages List ID:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue


$Web = Get-SPWeb $WebURL
$PagesListID = $web.Lists["Pages"].ID
$Web.AllProperties["__PagesListId"] = $PagesListID.ToString()

This PowerShell script to updates the property and corrects the problem.

Update Property Bag Settings using SharePoint designer:
You can also use SharePoint Designer to fix this problem. Here is how:
  • Get your "Pages" library's ID first! Here is How to get SharePoint list GUID
  • Open the SharePoint site which has this issue in SharePoint Designer
  • Select the site object in the tree view and Click on "Site Options" button from the ribbon
  • Check if the property "__PagesListId" exists, If so, update its value to current Pages library ID.
  • If the Property doesn't exists, Click on Add button to add the property. Enter "__PagesListId" as property name and value as the "Pages" Library GUID
  • Save your changes.
That's all!

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...