MOSS 2007 Recycle Bin: File Not Found Error

SharePoint MOSS 2007 has a nice two stage recycle bin which should cover one should anything get deleted accidentally. However there are cases when the recycle bin lets us down and throws a ‘File Not Found’ error when restoring items from the recycle bin. I experienced this recently and was lucky enough to find the cause and cure.

One possible cause for this error is when you are restoring items deep in a folder structure and the parent folder(s) have also been deleted. SharePoint is not smart enough to create placeholders for the parent folders prior to restoring the deleted item, it just gives up and throws an error.” To remedy this problem, restore the deleted parent folders from the Recycle bin first, then the restore of the child folders and files will now work.

You may also see this error in the ULS Logs:

File Not Found. at Microsoft.SharePoint.Library.SPRequestInternalClass.RestoreRecycleBinItem(String bstrWebUrl, Guid gItem)
at Microsoft.SharePoint.Library.SPRequest.RestoreRecycleBinItem(String bstrWebUrl, Guid gItem)
at Microsoft.SharePoint.SPRecycleBinItemCollection.RestoreCore(Guid[] ids)
at Microsoft.SharePoint.SPRecycleBinItemCollection.Restore(Guid[] ids)
at Microsoft.SharePoint.ApplicationPages.RecycleBinPage.ProcessAction(String action, String guidString)
at Microsoft.SharePoint.ApplicationPages.RecycleBinPage.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)