I've been playing around with scripts that read deleted files from the recycling bin such as the one below but I can't figure out how to read the files within a deleted folder without restoring it first. I'm beginning to think it might not be possible. Perhaps running a SQL statement is the only way. Can someone confirm whether it is actually possible without resorting to SQL? As far as I can tell the recycling bin does not behave like a list.

$rowlimit = 5000;    
$site = new-object Microsoft.SharePoint.SPSite("http://sptest.com/ncart");    
$query = new-object Microsoft.SharePoint.SPRecycleBinQuery;    
$query.ItemState = "FirstStageRecycleBin";    
$query.RowLimit = $rowlimit;    
$itemcoll = $site.GetRecycleBinItems($query);    
foreach ($item in $itemcoll) {
       write-host -nonewline "Found " $item.Title " ... ";

No - it is not possible to get content of a deleted folder. Remains only two options (as You already mentioned):

1) restore items from recycle bin to the original location and examine;

2) get data from SQL directly, querying content DB tables [RecycleBin] and [AllDocs]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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