Using a date range search
The following table outlines the properties that can be used to define an AQS query using a date range restriction:
Property |
Example |
Description |
---|---|---|
|
|
Searches for items received today. Searches for items received on February 17. Searches for items received between January 1 and April 1. |
|
|
Searches for items sent today. Searches for items sent on February 17. |
You can use relative dates when performing a date range restricted search. For example, today
, tomorrow
, or yesterday
can be used with the Received
or Sent
keywords.
You can use a specific day of the week (Sunday
, Monday
, Tuesday
, Wednesday
, Thursday
, Friday
, or Saturday
) with the Received
or Sent
keywords.
You can also use a specific month (January
, February
, March
, April
, May
, June
, July
, August
, September
, October
, November
, or December
) with the Received
or Sent
keywords.
Examples
If you want to delete all the messages in the administrator mailbox that were received today, use the following code:
Search-Mailbox -Identity administrator ` -SearchQuery "Received:today" ` -DeleteContent ` -Force
If you want to delete all the messages in the administrator mailbox that have been received between March and July, use the following code:
Search-Mailbox -Identity administrator ` -SearchQuery "Received:03/01/2013..07/01/2013" ` -DeleteContent ` -Force