Problem: 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.
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 $WebURL="http://SharePoint-Site-URL" $Web = Get-SPWeb $WebURL $PagesListID = $web.Lists["Pages"].ID $Web.AllProperties["__PagesListId"] = $PagesListID.ToString() $Web.Update()
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.
You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.