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.
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.
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 ![]()
4) Add a new view to the library and check the box “default view”
In this solution, you are going to replace some of the files in the /forms/ directory of the document library. To do this open 2 document libraries in explorer view and navigate to the “forms” folder which is displayed partially grayed out (note that you may have to show hidden files in your client explorer). In the screenshot below I am replacing the corrupt file “AllItems.aspx” with the same file from another library.
*** If you do NOT know what explorer view is or how to open it then STOP, you should not be doing this.
SharePoint Error: Code blocks are not allowed in this file, 9.0 out of 10 based on 2 ratings
Thank you very much for sharing this vital information. The issue has been resolved.
would like to add one more troubleshooting step here so everybody can take benefit of that.
problem description: not able to open the home page of the site and its throwing the below mentioned error message.
error message: not able to process “site URL”, Code blocks are not allowed in this file. Troubleshoot issues with Windows SharePoint Services.
additional step that you can check:
1) If there is any problem in case of web parts then try closing them from that specific page itself
How to do that: towards the end of the default.aspx, please append ?contents=1 so that it will open web parts maintenance page. select all and close and try open the site & check the results
2) if the home page is not opening then try to open settings.aspx page and check the results
How to do that: site URL/_layouts/settings.aspx. I am pretty much sure that this will open without any issues
3) press control O and this will give you the opportunity to open that same site in shared view
if any sub sites exist then copy the default.aspx and paste it site default structure
make sure to take the backup of the original default.aspx before overwritten the existing one. Thank you
omfg tyvm for posting this
