1

Is there anyway to make Outlook set the read email that doesn't have any categories assigned to them back to unread?

0

Try the following:

Public Sub Mark_Unread_If_No_Category()

    Dim objNS As Outlook.NameSpace: Set objNS = GetNamespace("MAPI")
    Dim olFolder As Outlook.MAPIFolder: Set olFolder = objNS.GetDefaultFolder(olFolderInbox)
    Dim Item As Object

    For Each Item In olFolder.Items
        If Item.Class = 43 Then  ' 43 = an email
            Dim oMail As Outlook.MailItem: Set oMail = Item
            If oMail.Categories = "" Then
                Debug.Print "Marking as unread: " & oMail.Subject
                oMail.UnRead = True
                oMail.Save
            End If
            Set oMail = Nothing
        End If
        DoEvents  ' So Outlook doesn't lock up whilst running
    Next

    Set olFolder = Nothing
    Set objNS = Nothing

End Sub

I know that it correctly looks in the inbox and it correctly finds emails without categories (the Debug.Print confirms this) however I've not checked that those emails become unread.

As a result, you should backup your inbox before you give this a go.

  • Thanks for the answer, how do you set it to just do it on one specific folder or inbox ? – Danial Hanafian Jan 16 '18 at 4:02
  • Assuming your folder (say "TPS Reports") sits within your inbox, then you should change objNS.GetDefaultFolder(olFolderInbox) to objNS.GetDefaultFolder(olFolderInbox).Folders("TPS Reports") – Richard Jan 16 '18 at 8:53
0

This is quite easy. Just create a Custom Search Folder, name it as you like (say, "Not categorized") select required folder(s), specify the Criteria on the Advanced tab as follows:

Field: All Mail Fields -> Categories
Condition: is empty

Click Add to List and then OK, OK.

Now you can select all messages in this folder and mark them all as Unread.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.