Deleted items retention is configured by default in Exchange Server 2007 for both mailboxes and individual items within a mailbox. For mailboxes, the default setting is 30 days, and for mail items, the default setting is 14 days. The retention periods can be changed using the following Windows PowerShell commands in Exchange Management Shell:

Set-MailboxDatabase `
 -Identity "Mailbox Database" `
 -DeletedItemRetention 7.00:00:00
Set-MailboxDatabase `
 -Identity "Mailbox Database" `
 -MailboxRetention 7.00:00:00

Note that the backtick (`) at the end of a line indicates that the command continues on the next line; in Exchange Management Shell, you could enter the command all on one line without the backticks. The time period is set with the following format: days.hours.minutes.seconds. In the examples, 7.00:00:00 indicates a retention period of seven days.

The Deleted items retention period can also be set per user by entering the command

Set-Mailbox `
 -ItemRetention 7.00:00:00

where is the account name of the individual user.

By default, deleted items retention enables restore of only soft-deleted mail (i.e., mail deleted via the Deleted Items folder in an Outlook mailbox). If a hard delete is performed (by pressing the Shift key when deleting the mail item), the item doesn't enter the deleted items retention system. However, you can change this behavior by making a registry modification on client systems. In the HKLM\SOFTWARE\Microsoft\Exchange\Client\Options subkey, create a new DWORD value named DumpsterAlwaysOn and set its value to 1. Making this modification has the potential to increase your Exchange storage requirements significantly if you keep deleted items for a long period of time.

After making the registry change, you'll be able to highlight any folder in Outlook and choose Tools, Recover Deleted Items to bring up the Recover Deleted Items window. Click the envelope icon to restore the item to the mailbox folder from which it was deleted.