[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 87
  • Last Modified:

outlook rule for unread email

Can i create a rule in outlook that moves all UNREAD email from my Inbox older than 30 days to another folder?
0
datatechdc
Asked:
datatechdc
1 Solution
 
Jessie Gill, CISSPCommented:
There is nothing in the outlook rules wizard that allows this.
0
 
Nick RhodeIT DirectorCommented:
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
 
VB ITSSpecialist ConsultantCommented:
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
 
David LeeCommented:
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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Tackle projects and never again get stuck behind a technical roadblock.
Join Now