Thursday, 12 November 2009

This Page has been modified since you opened it. You must open the page again


A lot of suggestions how to solve this:
- Add a "PublishingPageLayout" to the elements.xml file.
-Inherit from TemplateRedirectionPage instead of PublishingLayoutPage in the page layout file.
- MSO_PageHashCode is not cleared for detached pages.

None of the above had anything to do with my problem.

In my case it was two problems that throw the same error. I had one event receiver attached to a Pages library that did a call to "RunWithElevatedPrivileges" and did a SPListItem.Update() which caused the page to display the error message. I updated the event receiver according to this article, using the SPUserToken instead.

The other problem was that I had created a page with SharePoint Designer by right-clicking a Page Layout in masterpage and then choosing "New from Existing Page". This created the page but associated it with the wrong content type. Use SharePoint Manager 2007 and you will see that it attached the "Page" content type. Instead I used the web interface to create a new page and checked the content type which now was using "Welcome Page".

This leads me to the conclusion that the articles stating that you need to add a property "PublishingPageLayout" to your elements.xml files when provising (ex: create and upload files during feature activation) files are correct. But in my case I created a new page the wrong way (using SPD and not the web interface).

No comments: