Wednesday, March 9, 2011

Outlook View Dynamic Date Filter

This is an oldie but a goodie.  Refer to this article to see where I got this.  Situation:  I need to see emails that are older than 60 days in Outlook 2007 or 2010 so that I can delete them; so, I go in Outlook and I create a "view" of my inbox.  If you haven't ever done this before, in 2010 you click your inbox and then click the "View" tab and click "View Settings" on the left.  You will be presented with a box to modify your current view.  I just click the Filter... button, click on "Advanced", choose "Date/Time Field" -> "Received" for the field to check; then I click "on or before" for the middle dropdown; and type in any date for the Value and click "Add to List".  Then, go to the SQL tab and click the "Edit these criteria directly" checkbox.  At the end of what displays should be your actual date in single quotes...delete that and replace it with today(S) where S is the number of seconds you would like to offset from today and this can be a negative number to go backwards. So, I calculated that 60 days is 5184000 seconds before today so my SQL tab used to look like this:
"urn:schemas:httpmail:datereceived" <= '1/1/2011 12:00 AM'

and by using today(S) I converted it into this:

"urn:schemas:httpmail:datereceived" <= today(-5148000)

And that's it.  This will filter to only show items that are 60 days old or older.