Pages

Mar 6, 2012

SharePoint Error: Code blocks are not allowed in this file


Problem

Users report the following error when attempting to access a document library in SharePoint.
An error occurred during the processing of /site/SharedDocuments/Forms/AllItems.aspx. Code blocks are not allowed in this file.
image

Explanation

Ever so often I have clients contact me with a SharePoint library fully corrupted reporting an error such as “Code blocks are not allowed in this file”.  The error is, in fact, limited to a specific view but it’s usually the default view, therefore the error makes the library appear like it is completely inaccessible.  The root cause of the error is simple – a user replaced a view file from the /forms/ folder of the document library, typically “AllItems.aspx” such as the screenshot below suggests.  Typically this occurs when the user is using explorer view but I’ve heard of manifest presentations of this error as well.

Solution – Option 1

1) Open site that contains the library
2) Click on “Site Actions” >> “Site Settings” to view the site settings page “_layouts/settings.aspx”
3) Click on the library that displays the error to view the library’s settings page
image
4) Add a new view to the library and check the box “default view”

No comments: