积极答复者
如何快速清空已删除文件夹中的邮件?

问题
答案
-
你好,
中文版不是不支持,只是无法识别英文属性名称,导致使用全英文搜索的时候报错,但是,我们使用中文属性名称,同样是可以实现需求的啊,正如你上面测试的。
根据你最初的需求,我们也可以尝试下面的方式来搜索删除:
Get-mailbox -Resultsize unlimited | Search-mailbox -SearchQuery "发件人:user01 AND 主题:'test'" -deletecontent
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.- 已标记为答案 lczass 2016年11月7日 6:12
全部回复
-
你好,
据我所知,Search-mailbox指令无法搜寻特定文件夹的内容。
如果在outlook中直接右击“Deleted Items”文件夹选择“Empty folder”来删除,是否可行?
也可以尝试使用powershell运行下面的脚本来删除:
function Empty-DeletedItems {
$Outlook = New-Object -ComObject Outlook.Application
Foreach ($Folder in $Outlook.Session.Folders){
Foreach($MailFolder in $Folder.Folders ) {
if ($MailFolder.Name -eq "Deleted Items" -and $MailFolder.Items.Count -gt 0){
$itemcount = $mailfolder.items.count
do{
$mailfolder.items[$itemcount].Delete()
$itemcount = $itemcount - 1
}
while ($itemcount -gt 0)
}
}
}
}谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
你可以在单个用户的PC上运行这个脚本。
删除特定的邮件,可以使用Search-mailbox指令完成:
Get-mailbox| Search-mailbox -Searchquery 'Subject:"xxxxxxx"' -deletecontent
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
是报什么错误?
如果只是单个用户的话,最方便快捷就是通过outlook或者OWA上来清空deleted items文件夹。outlook上不行的话,试试OWA上是否可行。
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
这个就需要用到Search-mailbox指令了。
比如下面的指令,搜索user1邮箱中所有来自user2,并且主题中任意位置包含test文字的邮件:
Search-mailbox -Identity User1 -SearchQuery "from:user2 AND subject:'test'" -deletecontent
谢谢!Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
这个我之前的回复中其实已经提到了,可以直接搜索所有的mailbox:
Get-mailbox -Resultsize unlimited | Search-mailbox -SearchQuery "from:user2 AND subject:'test'" -deletecontent
谢谢!Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.- 已标记为答案 lczass 2016年10月20日 14:39
- 取消答案标记 lczass 2016年10月21日 14:28
- 已建议为答案 Niko.ChengModerator 2016年10月24日 6:16
-
你好,
我在我的环境测试成功了,如下图,供你参考:
是不是Searchquery的条件有问题,用 -searchquery ‘from:user01 AND subject:“test”’试试(注意单引号在外,test用双引号括起来)
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
根据报错信息,说是不支持此属性关键字。
建议你分开关键字信息查找,看看是哪个属性的关键字不能查找,比如用 -searchquery ‘from:user01’ 和 -searchquery ‘subject:test' 分两次执行查找指令。
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
由于你之前的报错是有关键字不支持,让你分开执行,只是为了确认是哪个属性不支持,方便精确排错。另外,你选择的是直接删除邮件,是不会显示discovery search mailbox的,可以参考我之前给你的截图,运行成功后,也不会显示discovery search mailbox的。
我的测试环境就是一台纯Exchange2010全角色服务器。
按照你上图的执行结果,是搜索user01邮箱中所有包含单词“test”的邮件,无论是主题或是正文中包含的都会搜索到。
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你的exchange 版本是什么?
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
我的测试环境是SP3的,如我上面截图显示,运行指令是没有问题的,并且Exchange 2010 SP1版本已经过于老旧,建议你升级到Exchange 2010最新的SP3 RU15在看看。
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
你安装的是中文版的Exchange吗?
如果是的话,尝试使用中文来搜索看看,如下:
Search-mailbox -identity user01 -searchquery “主题:test” -deletecontent
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
中文版的环境目前我手头上没有,这个是我看到另外一篇跟你问题很相似的帖子中有提到的,你也可以参考下:
http://bbs.exchangecn.com/read-htm-tid-8712.html
这个可能就是问题的症结所在,你也可以发送一封以中文主题为例的测试邮件,然后尝试搜索看看:
Search-mailbox -identity user01 -searchquery “主题:测试” -deletecontent
如果可以成功运行,那么就可以确认问题了。
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
这个应该就是安装语言的问题,由于你安装的是中文版本,所有在高级关键字搜索的过程中,只识别中文的属性名称。
你可以尝试安装英文语言包试试。
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
中文版不是不支持,只是无法识别英文属性名称,导致使用全英文搜索的时候报错,但是,我们使用中文属性名称,同样是可以实现需求的啊,正如你上面测试的。
根据你最初的需求,我们也可以尝试下面的方式来搜索删除:
Get-mailbox -Resultsize unlimited | Search-mailbox -SearchQuery "发件人:user01 AND 主题:'test'" -deletecontent
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.- 已标记为答案 lczass 2016年11月7日 6:12
-
你是如何去匹配转发和答复邮件的呢?能否贴图出来看看。
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
是这样吗:
-Searchquery "主题:‘转发’"
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
去掉转发后面的冒号呢是否可以呢?能否截图看看。
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
尝试下面的搜索条件看看:
-Searchquery "发件人:user01 AND 主题:转发"
有关具体搜索的属性应用,推荐你参考下面的文章:
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
这个应该是预期的,当我们按关键字搜索邮件的时候,会找到所有匹配关键字的邮件,例如,当使用“主题:test"搜索时,会返回主题行中包含单词test所有邮件,无论是转发还是回复的邮件。
如果你要搜索精确短语的话,比如你上面的例子,搜索主题行中包含“啊啊啊 曹操”短语的邮件时,可以使用‘主题:“啊啊啊 曹操”’来搜索(注意双引号的应用,这个在我上面给出的链接中有详细说明。)
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com. -
你好,
这个貌似还真的不行,我也测试过了,使用“subject:FW”来搜索转发的邮件,无法成功搜到,如下:
谢谢!
Niko Cheng
TechNet Community Support
Please remember to mark the replies as answers.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.