Saturday 9 December 2017

Unable to check-in the pages which are checked out in SharePoint 2010 publishing site

We have a publishing site created in SharePoint 2010 and suddenly we could not check-in the pages and started receiving the below error when we are trying to check-in the page.



"An unexpected error has occurred" with Correlation Id.

Actual Error in the Log File



System.ArgumentException: Invalid SPListItem. The SPListItem provided is not compatible with a Publishing Page. at Microsoft.SharePoint.Publishing.PublishingPage.GetPublishingPage(SPListItem sourceListItem) at Microsoft.SharePoint.Publishing.Internal.WebControls.PublishingPageStateControl.RaisePostBackEventForPageRouting(String eventArgument, SPRibbonCommandHandler control, RaisePostBackEventDelegate raisePostBackEventDelegate) at Microsoft.SharePoint.Publishing.Internal.WebControls.PublishingPageCheckinHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


If the publishing feature is deactivated and activated again on a publishing site, it may sometimes point to a new ID to pages library. To reset this ID back we need to execute the below powershell script.

$web = get-spweb "http://site-collection/path-to-affected-site"
$correctId = $web.Lists["Pages"].ID
$web.AllProperties["__PagesListId"] = $correctId.ToString()
$web.Update()
$web.AllProperties["__PublishingFeatureActivated"] = "True"
$web.Update()

No comments:

Post a Comment