Oh my god – I have written a short, useful post instead of a bloated theory fest! What is the world coming to?
I was all set to go and catch up with SharePoint Sezai today, when the phone rang and the IT guy from one of my clients had a wee problem. Someone had been doing some serious file rearrangement surgery on a large document library with folders (yeah, yeah, I know – “folders are evil” blah, blah). In one of those typical right mouse click spasms that we sometimes have, a large folder was blown away.
“No problem”, thinks the IT guy. “I’ll use my trusty SharePoint recycle bin to restore it.”
Sure enough, there is the folder listed, so they select it and choose to restore.
Uh-oh – error!
The IT guy took the above screenshot and mailed it through to me. From looking at the <sacrasm>incredibly useful, non threatening and clear error message above</sacrasm>, it was the presence of the LoadRecursive() function that gave me a hunch as to what was going on.
Turns out that it wasn’t just this particular folder that was accidentally deleted. The parent folder had been deleted also. But the problem was that during this major file rearrangement surgery that I mentioned at the start of this article, that parent folder had been replaced with a new one with the same name.
The recycler cannot handle this. It seems to make two assumptions
- It assumes that you always want to restore something back to the original location that it was deleted from
- It expects that if something has been deleted from a list of library, it sure as hell should not exist when you attempt to restore it back to the site.
I asked the IT guy to rename the second, identically named folder to something different and then reattempt the restore.
Bingo! My client is happy, their IT guy lives to fight another day and I now have learned the meaning behind yet another barely decipherable SharePoint stack trace :-).
(Turns out I shouldn’t have cancelled on Sezai after all!)
Thanks for reading
P.S: Now for the Google crawler, the text version of the error in teensy font 🙂
The item cannot be restored. at Microsoft.SharePoint.SPRecycleBinUtility.ThrowAppropriateRestoreException(SPException ex, SPRecycleBinItem lastItem)
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.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)