Delete emails with X size and X days

Delete emails with X size and X days in Office 365

Search-Mailbox

Use the Search-Mailbox cmdlet to search a mailbox and copy the results to a specified target mailbox, delete messages from the source mailbox, or both.

Search-Mailbox -Identity user@domain.com -SearchQuery {(size:2000000…3000000) -and (Received:1/1/2019…12/17/2019)} -DeleteContent -Force

Searchable email properties

AttachmentNames
The names of files attached to an email message.
attachmentnames:annualreport.ppt
attachmentnames:annual
*

Bcc
The Bcc field of an email message
bcc:pilarp@contoso.com
bcc:pilarp
bcc:“Pilar Pinilla”

Category
The categories to search. Categories can be defined by users by using Outlook or Outlook on the web (formerly known as Outlook Web App). The possible values are:
blue
green
orange
purple
red
yellow
category:“Red Category”

Cc
The Cc field of an email message.
cc:pilarp@contoso.com
cc:“Pilar Pinilla”

Folderid
The folder ID (GUID) of a specific mailbox folder. If you use this property, be sure to search the mailbox that the specified folder is located in. Only the specified folder will be searched. Any subfolders in the folder won’t be searched. To search subfolders, you need to use the Folderid property for the sub-folder you want to search.
For more information about searching for the Folderid property and using a script to obtain the folder IDs for a specific mailbox, see Use Content Search in Office 365 for targeted collections.
folderid:4D6DD7F943C29041A65787E30F02AD1F00000000013A0000
folderid:2370FB455F82FC44BE31397F47B632A70000000001160000 AND participants:garthf@contoso.com

From
The sender of an email message.
from:pilarp@contoso.com
from:contoso.com

HasAttachment
Indicates whether a message has an attachment. Use the values true or false.
from:pilar@contoso.com AND hasattachment:true

Importance
The importance of an email message, which a sender can specify when sending a message. By default, messages are sent with normal importance, unless the sender sets the importance as high or low.
importance:high
importance:medium
importance:low

IsRead
Indicates whether messages have been read. Use the values true or false.
isread:true
isread:false

ItemClass
Use this property to search specific third-party data types that your organization imported to Office 365. Use the following syntax for this property: itemclass:ipm.externaldata.
itemclass:ipm.externaldata.Facebook* AND subject:contoso
itemclass:ipm.externaldata.Twitter* AND from:“Ann Beebe” AND “Northwind Traders”*

Kind
The type of email message to search for. Possible values:
contacts
docs
email
externaldata
faxes
im
journals
meetings
microsoftteams (returns items from chats, meetings, and calls in Microsoft Teams)
notes
posts
rssfeeds
tasks
voicemail
kind:email
kind:email OR kind:im OR kind:voicemail
kind:externaldata

Participants
All the people fields in an email message. These fields are From, To, Cc, and Bcc.
participants:garthf@contoso.com
participants:contoso.com

Received
The date that an email message was received by a recipient.
received:04/15/2016
received>=01/01/2016 AND received<=03/31/2016
Messages that were received on April 15,

Recipients
All recipient fields in an email message. These fields are To, Cc, and Bcc.
recipients:garthf@contoso.com
recipients:contoso.com

Sent
The date that an email message was sent by the sender.
sent:07/01/2016
sent>=06/01/2016 AND sent<=07/01/2016

Size
The size of an item, in bytes.
size>26214400
size:1…1048567

Subject
The text in the subject line of an email message.
Note: When you use the Subject property in a query, the search returns all messages in which the subject line contains the text you’re searching for. In other words, the query doesn’t return only those messages that have an exact match. For example, if you search for subject:“Quarterly Financials”, your results will include messages with the subject “Quarterly Financials 2018”.
subject:“Quarterly Financials”
subject:northwind

To
The To field of an email message.
to:annb@contoso.com
to:annb
to:“Ann Beebe”

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值