Rule: delete older than 2 weeks.

  • Thread starter Thread starter JohanW
  • Start date Start date
J

JohanW

Hello,
i would like to program a rule that deletes certain messages
(depending on the subject-title) to be deleted when they are older than
two weeks.
I cannot archive because i don't want this to apply to ALL my messages.

I'm struggling with the time issue in my code for the older than 2 weeks
part.

Anyone know how to solve this ??
I started with this example code from microsoft
http://msdn.microsoft.com/en-us/library/bb206765.aspx

Thank you.
 
This is Outlook 2007 I assume? What language are you programming on? Is this
Outlook VBA or a COM addin or what? If this was Outlook VBA use the
DateDiff() function to subtract 14 days from Date to get to 2 weeks ago.

If that's too vague then post the part of the code you're stuck on so people
can see it an maybe help. Also provide any other relevant information.
 
It's idd outlook 2007 and VBA.
I need something like the code below, but then for the date when the
email was send.. i cannot find out
the right code howto address the date (and hour?) the mail was send.


This code will set the condition for a rule. Here it will limit the
application
of the rule only to emails with recipient "Dan Wilson".
---
Set oFromCondition = oRule.Conditions.From
With oFromCondition
.Enabled = True
.Recipients.Add ("Dan Wilson")
.Recipients.ResolveAll
End With
 
MailItem.ReceivedTime is when the email was received, MailItem.SentOn is
when it was sent out. Is that what you want?
 
Yeah!
Looked for that for some time.
Thank you very much!



Ken Slovak - said:
MailItem.ReceivedTime is when the email was received, MailItem.SentOn is
when it was sent out. Is that what you want?
 
Back
Top