Recently my mailing lists subscriptions grew to an extend not seen before, largely due to my grown interest in ALT.NET and open source projects. Having an eye on the dev or user mailing lists is often very valuable to stay on top of recent developments, identify best practices and to post or answer the occasional question.
However, that doesn't come without drawbacks. One increasing hassle is to keep up with the constant flow of information such that I see myself forced to reset once in while. After getting back from a 3-day vacation this summer I had 200+ unread feed items and uncounted unread mailing lists messages. I do not claim to read everything that lands in my inbox(es) so a quick "mark all as read" is a very relieving act. FeedDemon, my feed reader, even has a panic button to support this discomforting situation.
Unfortunately Outlook does not support marking all items read in a certain folder and all of its subfolders. On the other hand, there is this ancient VBA language that you can use to program Outlook…
Sub MarkAllRead() Dim resultFolder As folder Dim folder As folder Dim item As MailItem Set resultFolder = GetFolder("path\to\your\mailing\lists\root\folder") For Each folder In resultFolder.folders For Each item In folder.Items.Restrict("[unread] = true") item.UnRead = False Next Next Set resultFolder = Nothing Set folder = Nothing Set item = Nothing End Sub Function GetFolder(strFolderPath As String) As MAPIFolder ' strFolderPath needs to be something like ' "Public Folders\All Public Folders\Company\Sales" or ' "Personal Folders\Inbox\My Folder" Dim colFolders As Outlook.folders Dim objFolder As Outlook.MAPIFolder Dim arrFolders() As String Dim i As Long On Error Resume Next strFolderPath = Replace(strFolderPath, "/", "\") arrFolders() = Split(strFolderPath, "\") Set objFolder = Application.GetNamespace("MAPI").folders.item(arrFolders(0)) If Not objFolder Is Nothing Then For i = 1 To UBound(arrFolders) Set colFolders = objFolder.folders Set objFolder = Nothing Set objFolder = colFolders.item(arrFolders(i)) If objFolder Is Nothing Then Exit For End If Next End If Set GetFolder = objFolder Set colFolders = Nothing End Function
Thanks to Lars Keller for the hint to filter unread items with Restrict()!
Restrict()
a@href@title, blockquote@cite, em, strike, strong, sub, sup, u