Tuesday, August 20, 2013

Check-in Page Error in Pages Document Library


When trying to Check in a page into a Pages Document Library in a Publishing site getting an error and it won't check page in.



Error from ULS Viewer:
System.ArgumentException: Invalid SPListItem. The SPListItem provided is not compatible with a Publishing Page. 

Run Powershell to fix:
$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()