In this post we will discuss about changing recycle bin settings in SharePoint 2010. Also you can check out my previous posts on:
Recycle bin is a good feature of SharePoint 2010. If you accidentally delete a document or other item from the SharePoint site, it is deleted from the site and moved to the site Recycle Bin, where it can be restored.
By default an item will stored in Recycle bin for 30 days and after that it will delete permanently. But you can also change the recycle bin settings through Browser, Object model as well as PowerShell.
Change through Browser:
To change the setting, Open SharePoint central administration then go to Application Management -> Manage web applications and select the web application you want t modify the settings.
Then click on General Settings. This will open the General Settings in a dialog box. Then navigate to the Recycle Bin section. There you can make the Recycle Bin Status to off, you can change the number of days also. Check the fig below:
Change through SharePoint Object Model:
You can also change the Recycle Bin settings through SharePoint 2010 object model.
webApplication.RecycleBinEnabled = true;
webApplication.RecycleBinRetentionPeriod = 45;
Change through PowerShell:
Run below PowerShell command:
$webApplication = get-spwebapplication "http://WebApplicationURL"
$webApplication.RecycleBinEnabled = $true
$webApplication.RecycleBinRetentionPeriod = 45