Solved

outlook rule for unread email

Posted on 2015-01-09
5
6 Views
Last Modified: 2016-06-03
Can i create a rule in outlook that moves all UNREAD email from my Inbox older than 30 days to another folder?
0
Comment
Question by:datatechdc
5 Comments
 
LVL 8

Expert Comment

by:Jessie Gill, CISSP
ID: 40541046
There is nothing in the outlook rules wizard that allows this.
0
 
LVL 22

Expert Comment

by:Nick Rhode
ID: 40541047
Rules are applied as email arrives into the inbox.  You might be able to create a manual rule that you can run whenever you want but as for an automatic rule to apply to the mailbox I don't think that is possible with outlook.
0
 
LVL 24

Expert Comment

by:VB ITS
ID: 40541899
As the above experts have mentioned, this is not possible to do within Outlook.

You'll have to look at third party Outlook add-ins to do this. Perhaps have a look at Auto-Mate and see if it can do what you want as it's a pretty powerful add-in for email management. Note that it's not free, however you can trial it for 30 days to see if it can address your issue.
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 40553371
datatechdc,

While you cannot do this with a rule, you can do it with a simple macro like the one below.  Let me know what version of Outlook you're using and I'll post instructions for adding the code to Outlook.

Sub MoveUnreadOver30()
    'On the next line, edit the path to the folder you want to move the unread messages to
    Const ARCHIVE_FOLDER_PATH = "Mailbox\SomeFolder"
    Const MACRO_NAME = "Move Unread Message Over 30 Days Old"
    Dim olkInb As Object, olkFld As Object, olkMsg As Object, lngPtr As Long, lngCnt As Long, datMinus30 As Date
    datMinus30 = DateAdd("d", -30, Date)
    Set olkFld = OpenOutlookFolder(ARCHIVE_FOLDER_PATH)
    Set olkInb = Session.GetDefaultFolder(olFolderInbox).Items.Restrict("[Unread] = True AND [ReceivedTime] <= '" & Format(datMinus30, "ddddd h:nn AMPM") & "'")
    For lngPtr = olkInb.Count To 1 Step -1
        If olkMsg.Class = olMail Then
            Set olkMsg = olkInb.Item(lngPtr)
            olkMsg.Move olkFld
            lngCnt = lngCnt + 1
        End If
    Next
    Set olkMsg = Nothing
    Set olkFld = Nothing
    Set olkInb = Nothing
    MsgBox "Operation complete.  I moved " & lngCnt & " messages.", vbInformation + vbOKOnly, MACRO_NAME
End Sub

Private Function OpenOutlookFolder(strFolderPath As String) As Outlook.MAPIFolder
    ' Purpose: Opens an Outlook folder from a folder path.'
    ' Written: 4/24/2009'
    ' Author:  BlueDevilFan'
    ' Outlook: All versions'
    Dim arrFolders As Variant, _
        varFolder As Variant, _
        bolBeyondRoot As Boolean
    On Error Resume Next
    If strFolderPath = "" Then
        Set OpenOutlookFolder = Nothing
    Else
        Do While Left(strFolderPath, 1) = "\"
            strFolderPath = Right(strFolderPath, Len(strFolderPath) - 1)
        Loop
        arrFolders = Split(strFolderPath, "\")
        For Each varFolder In arrFolders
            Select Case bolBeyondRoot
                Case False
                    Set OpenOutlookFolder = Outlook.Session.Folders(varFolder)
                    bolBeyondRoot = True
                Case True
                    Set OpenOutlookFolder = OpenOutlookFolder.Folders(varFolder)
            End Select
            If Err.Number <> 0 Then
                Set OpenOutlookFolder = Nothing
                Exit For
            End If
        Next
    End If
    On Error GoTo 0
End Function

Open in new window

0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

Learn more about how the humble email signature can be used as more than just an electronic business card. When used correctly, a signature can easily be tailored for different purposes by different departments within an organization.
Create high volume marketing opportunities using email signatures with these top 10 DOs and DON'Ts of email signature marketing.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now