Is there anyway to make Outlook set the read email that doesn't have any categories assigned to them back to unread?
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.
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.