How to fix the AllItems.aspx getting overwritten

What if a user accidentally overwrites the AllItems.aspx page for a document library? Well it gave me a slight heart attack when this happened recently. But I was able to find a fix pretty quickly. Here’s what I did:

 

Open the site in SharePoint Designer 2010. When in your troubled site where the document library lives go to Site Actions > Edit in SharePoint Designer.

Once in SPD in the left nav go to Lists and Libraries

Then under the Document Libraries section choose your document library

 

Your library will open in a tab where you can see all info and settings for this library. What we are concerned with is under the Views section:

 

The AllItems.aspx is the All Documents view that you see listed here. So what you do now is click on New on the upper right corner of the View section.

 

Name it something like All_Items, then check the box to make this your default view. Click Ok.

 

Now you will be able to open your document library again! You can now remove the old corrupt All Documents view, and rename your new All_Items to All Documents and you are back in business!