Link to home
Start Free TrialLog in
Avatar of stacystyles
stacystyles

asked on

Rule to Mark Emails as Read in 7 days

I would like to create a rule so that any emails that are not read in 7 days will automatically appear as read.  I am using Outlook 2010
Avatar of Anthony2oo5
Anthony2oo5

I don't think you can get a rule to do this, but you could make a rule to move the messages to a certain folder and then use auto archive the items after 7 days, and also set auto archive to set it as read.
Avatar of stacystyles

ASKER

This is what we do right now and just don't like seeing all the unreads.  ;o(
Avatar of David Lee
@Anthony2oo5 - Thank you!
We still want the emails just want to mark them as read.  Thanks guys!
Hi, stacystyles.

That just requires a simple modification to the code.  
Sub MarkMessagesReadAfter7Days()
    Dim olkItems As Outlook.Items
    Set olkItems = Session.GetDefaultFolder(olFolderInbox).Items.Restrict("[UnRead] = True")
    For intCount = olkItems.count To 1 Step -1
        If DateDiff("d", olkItems.Item(intCount).ReceivedTime, Now) >= 7 Then
            olkItems.Item(intCount).Unread = False
            olkItems.Item(intCount).Save
        End If
    Next
    Set olkItems = Nothing
End Sub

Open in new window

This looks like it worked.  Any way to run this against sub folders that know of?
All subfolders or subfolders under the inbox?
Subfolders under the Inbox
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial