Checked-out page shows as record

Having a notification that your page has been declared as a record can be a bit misleading as some other blog posts have been pointing out, since the message not always is expected. As has been suggested in this page about the issue appearing in SharePoint 2013 or this one on SharePoint 2010 the solution is fairly simple; make sure the page is checked in.

Knowing the solution got me where I wanted, yet I still was a bit confused on why SharePoint would think it would be a record, so I dug into it a bit further.

Every page will call the SPPageStateControl  that will be responsible to determine the PageState. This Control has a method called PopulateStates, that determines the different states a page can have. If you would hit a page and use the console to check some properties, you will see there is a PageState object that you can check.

On a normal page you will see something like:

PageState object for a normale page

While if you would enter a checked out page you would see a few more properties (depending on who has the page checked out).

PageState object for a checked-out page

As you can see a checked out page has a few more flags, and depending on who that page is checked out to these flags are set. The SystemUser is the user that is running the app pool, and as you can see it will set the CheckedOutToCurrentUser even if we haven’t checked it out.

Based on this flag a second method kicks in, the PopulateStatusMessages(). This method will populate an array of of messages that can be shown to a user if there is a need to do so. One of these checks is the following:

if (this.currentState["ItemIsCheckedOutToSystemUser"] != null)
{
   value = SPHttpUtility.HtmlEncode(SPResource.GetString("PageStatusCheckedOutToSystem", new object[0]));
}

Based on that knowledge you can open the Microsoft.SharePoint.Publishing.Intl that will contain a resource entry with that name, and a value like “This page has been declared a record or placed on hold and is locked as read-only”.

So whenever a file is checked out to the system account, and you are running SharePoint 2010 Server (Foundation will not have publishing, thus will not have the resources), or SharePoint 2013 you will be likely to encounter this error if the System account has files checked out.

A note on the side is that you should never use the system account to actually change files, and I am fully aware of that, yet sometimes you have a small dev box where you can encounter errors like this.

Leave a Reply