如果您的Outlook帐户中有大量电子邮件需要删除,您可以将它们永久删除。然后应将它们移动到文件夹 Recoverable Items > Deletions,它们将在其中保留 14 天。但是,如果 14 天还不够,那么将其增加到 30 天怎么样?是的,这是可能的。
从标题可以看出你需要有一个Microsoft Exchange Online帐户,所以如果你是家庭用户,那么这篇文章很可能不适合你,但同时,你可以继续阅读学习新东西。
在继续之前,我们必须指出您必须使用Exchange Online PowerShell,因为目前无法从Outlook或Outlook网页版中进行所需的更改。这很奇怪,但它就是这样,所以在微软(Microsoft)做出一些改变之前,我们必须使用可用的东西。
在Outlook(Outlook)中更长时间地保留永久删除的电子邮件
无论出于何种原因,您可能希望将已删除的电子邮件保留更长时间,而本指南将有助于完成该任务。我们将介绍以下内容:
- 选择正确的权限
- 将Windows PowerShell(Windows PowerShell)连接到Exchange Online
- 断开远程PowerShell会话
1]选择正确的权限(1] Select the correct permissions)

首先(First)要做的就是分配对这个特定问题有意义的权限。为此,您必须访问docs.microsoft.com并检查“收件人配置权限”部分,然后在您的(Recipient provisioning permissions)Exchange Online服务器上分配下面列出的权限。
2] 将 Windows PowerShell 连接到 Exchange Online(2] Connect Windows PowerShell to Exchange Online)

为了使事情顺利进行,我们必须首先将您的Exchange Online服务器与Windows PowerShell连接起来。我们可以通过从本地计算机启动PowerShell来完成此操作,然后复制并粘贴以下命令:
$UserCredential = Get-Credential
当对话框出现时,请输入您的学校或工作帐户,然后输入您的密码,然后单击确定。然后,下一步是复制并粘贴另一个命令,如下所示:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

此外,在执行上一个命令后运行此命令:
Import-PSSession $Session -DisableNameChecking
3]断开远程PowerShell会话(3] Disconnect the remote PowerShell session)
完成所有这些后,我们建议不要直接关闭Windows PowerShell,而是断开它。你看,如果你关闭窗口,你可能会用完所有可用的远程PowerShell会话,你需要等待会话过期。
要断开会话,请复制并粘贴以下命令,然后按Enter键运行它:
Remove-PSSession $Session
4]更改永久删除项目的保留时间(4] Change how long permanently deleted items are kept)
现在是时候做你最初来这里做的事情了,所以请再次启动Windows PowerShell,在框中键入以下命令并按Enter:
Set-Mailbox -Identity "Emily Maier" -RetainDeletedItemsFor 30
请记住(Bear),此命令适用于特定邮箱。请(Please)删除Emily Maier并将其替换为您首选邮箱的名称。此外,此命令会将删除日期设置为 30 天。
至于对所有邮箱进行更改,请复制并粘贴以下内容:
Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox')} | Set-Mailbox -RetainDeletedItemsFor 30
好的,就是这样,我们完成了。如果您需要更多信息,请访问Microsoft.com。
How to keep deleted emails for longer in Outlook via Exchange Online
If yоu have a ton of email in your Outlook account that just needs to go, you can permanently have them deleted. They should then be moved to the folder, Recoverable Items > Deletions, where they will be kept for 14 days. However, if 14-days is not enough, then how about increasing it to up to 30-days? Yes, that is possible.
From the title, it is clear you will need to have a Microsoft Exchange Online account, so if you are a home user, then chances are this article is not for you, but at the same time, you can continue to read along in order to learn something new.
Before going forward, we must point out that you must use Exchange Online PowerShell since, at this time, it is not possible to make the changes needed from within Outlook or Outlook on the web. It’s odd, but it is what it is, so until Microsoft makes some changes, we have to work with what is available.
Keep permanently deleted emails longer in Outlook
For whatever reason, you might want to keep deleted emails for a little bit longer, and this guide will aid in achieving that task. We will cover the following:
- Select the correct permissions
- Connect Windows PowerShell to Exchange Online
- Disconnect the remote PowerShell session
1] Select the correct permissions

First thing first, and that is to assign the permissions that makes sense for this specific issue. To do this, you must visit docs.microsoft.com and check the section, Recipient provisioning permissions, and assign the one listed below on your Exchange Online server.
2] Connect Windows PowerShell to Exchange Online

In order to make things work, we must first connect your Exchange Online server with Windows PowerShell. We can do this by launching PowerShell from your local computer, then copy and paste the following command:
$UserCredential = Get-Credential
When the dialog box comes up, please type in your school, or work account, then your password, and click OK. The next step, then, is to copy and paste another command, and it goes like this, here:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Also, run this command after performing the previous:
Import-PSSession $Session -DisableNameChecking
3] Disconnect the remote PowerShell session
After all of that is done, we suggest not closing Windows PowerShell outright, but instead disconnect it. You see, if you close the window, you could use up all the remote PowerShell sessions available to you, and you’ll need to wait for the sessions to expire.
To disconnect the session, then, copy and paste the following command, then run it by hitting the Enter key:
Remove-PSSession $Session
4] Change how long permanently deleted items are kept
Now its time to do what you came here to do in the first place, so please fire up Windows PowerShell again, and type the following command into the box and hit Enter:
Set-Mailbox -Identity "Emily Maier" -RetainDeletedItemsFor 30
Bear in mind that this command is for a specific mailbox. Please remove Emily Maier and replace it with the name of your preferred mailbox. Furthermore, this command will set the deletion date to 30 days.
As for making changes to all mailboxes, please copy and paste the following:
Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox')} | Set-Mailbox -RetainDeletedItemsFor 30
OK, so that’s it and we are done. If you need more information visit Microsoft.com.