Monday, November 4, 2013

The SPListItem provided is not compatible with a Publishing Page.

Scenario:

I have a SharePoint 2010 site collection with publishing feature enabled. I am able to check-out pages but not able to check-in pages. Below is the error during check-in.

"An unexpected error has occurred" with Correlation Id.

Actual Error in 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)

Resolution:

First try to Deactivate and ReActivate the Sharepoint Site Publishing Infrastructure feature at both Scopes (Site And Web) level.

If this will not solve your problem then try to run following Power shell 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()

That's it.... Enjoy with the solution.... Please provide your feedback if this post is helpful to you....



5 comments:

  1. Thank you very much for this solution. Its really helpful, resolved my issue.

    ReplyDelete
  2. Helped me too...

    ReplyDelete
  3. This fixed my issue. But what was the underlying issue ?

    ReplyDelete
  4. Reactivating sharepoint publishing feature fixed this issue

    ReplyDelete
  5. I had tried everything else . and this was the one that worked.
    thanks :)

    ReplyDelete