01-02-19 06:27 PM
01-02-19 06:59 PM
01-02-19 08:25 PM
01-02-19 08:57 PM
Rereading that, I realize I should have put an example in. This would go between the dataTableColumns.Add section and the start of the For Each loop. 'Due to the filter string, this is stored as a dynamic COM object. Any modification to a mail item (IE mark read, move, delete) will cause the array length to change and will break the for each.
Requeue: Dim folderItems = If(Filter_Expression """", folder.Items.Restrict(Filter_Expression), folder.Items) if Oldest then folderItems.Sort(""[SentOn]"",False) else folderItems.Sort(""[SentOn]"",True) end if
In the middle of that loop, you'd have it check to mark as read.
if MarkRead = True then item.UnRead=0 end if
By the time you get to the very end of the loop, you may have also deleted or moved it. All of these need to be checked, assuming you allow for those inputs.
if MarkRead or Delete or moveTo """" then goto Requeue end if Next
It's a hack, but it works. And if you haven't had to modify one of those mails, then the For Each should just continue as it was.
04-03-19 09:47 AM