SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There is a SharePoint List from which many records have been deleted using CAML. The records are available in the Recycle Bin.

Is there an way to recover the records using scripting/CAML etc ? Since it's not efficient to recover the records manually.

Regards, André

share|improve this question
found something on… – Dre May 23 '11 at 7:35
up vote 1 down vote accepted

This code will restore all the items deleted from the specified list:

string listUrl = "web/relative/list/url"; // without leading slash!
var toRestore = new List<SPRecycleBinItem>();
foreach (SPRecycleBinItem recycleBinItem in web.RecycleBin)
    if (recycleBinItem.ItemType == SPRecycleBinItemType.ListItem
        && recycleBinItem.DirName.ToLowerInvariant() == listUrl.ToLowerInvariant())

foreach (var itemToRestore in toRestore)

Note: this code will require elevated privilegies, if you want to allow ordinary portal users to use it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.