Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is recycle bin a list? And can we query recycle bin to get items deleted from a list,if so how to do it? And also where is the recycle bin data actually stored, is it stored in the content db ?

share|improve this question

2 Answers 2

No, Recyle bin is not a List like other document library and lists. Yes you can Query Recyle Bin item like SPWeb.GetRecycleBinItems Method

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.getrecyclebinitems(v=office.12).aspx

All files are internally stored in Content DB in Sharepoint. Once it is Deleted permanently from Sharepoint, they it will be deleted from Content DB.

share|improve this answer

No it is not a list, it's work on the same concept as we have in windows.

yes you can access it via powershell or other ways. here is powershell example.

# recycle bin's are tied to a site collection so we need a site collection object

$site = get-spsite http://www.yoururl.com

#we can see everything in the recycle bin like this:
$site.Recyclebin

#unfortunately, the above command dumps quite a lot to the screen.
#fortunately, we can pipe the output to other commands for filtering and cleanup.

#This command will return all the webs in the recyclebin
$site.Recyclebin | where {$_.itemtype -eq "web"}

#we can build on this by adding a sort statement, 
#here I sort by dirname, which is the URL path the item would have been at before it was deleted
$site.Recyclebin | where {$_.itemtype -eq "web"} | sort dirname

# we can format the output into a nice list
$site.Recyclebin | where {$_.itemtype -eq "web"} | sort dirname | select title, itemtype, dirname, itemstate

#note that in the above listing, itemstate shows which recycle bin it's in (FirstStageRecyclebin = End user Recycle Bin Items, SecondStageRecycleBin = Deleted from end user Recycle Bin)

#here's one more application of filtering to show everything that's not a page nor a list item

$site.RecycleBin | where { $_.itemtype -ne "file" -and $_.itemtype -ne "ListItem" } | sort dirname | select title, itemtype, dirname

In SharePoint everything stored into the Content Database, So all deleted items stored into the Content DB until permanently deleted from recycle bin.

share|improve this answer
    
Good answer. Please note that recycle bin has two levels, SPWeb and SPSite. Anyway, quering SPSite will return both. –  ppatalong Jun 19 at 20:40

Your Answer

 
discard

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.