Search code examples
vbams-officeoffice-2010

auto-move email back to Inbox on flagged due date


I am wondering how I can make it so when flagged e-mails are due they move from some folder to the Inbox.

Essentially, I have written some VBA that makes Outlook work like Inbox by Google. The VBA:

  • lets me "snooze" e-mails in the Inbox for a number of days I pick and hide it (using view filters)
  • if a new e-mail comes in matching a "snoozed" e-mail then it categories the message with a message so when I open the e-mail I'll know there are e-mails in the same conversation that are hidden
    • when the a "snoozed" email's timer is up it automatically shows back up in the Inbox

Right now my code "hides" the e-mail by using View filters:

"http://schemas.microsoft.com/mapi/proptag/0x10900003" = 1 OR
"http://schemas.microsoft.com/mapi/proptag/0x10900003" = 0 OR
"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/81050040" <= 'Today' OR
"urn:schemas:httpmail:messageflag" IS NULL

However, I was thinking, instead of hiding it I should move "snoozed" e-mails to another folder.

The part I'm stuck with is moving the e-mails back to the Inbox after their timer is up.

I guess I need some way to hook into something that triggers when a flagged e-mails due date has approached?

The reason I want to do this is because if someone sends me an email that they have flagged then because my view filter hides all flagged messages the e-mail will come in as hidden and I won't see it until its due.


Solution

  • One option is to trap the Application.Reminder event, which supplies the Item object which triggered the event. However this requires that flags also have a reminder set on them. The only other alternatives is to scan the Mailbox on a timer or Outlook start - or the ToDo List - and calculate the due dates for every flagged item.