cancel
Showing results for 
Search instead for 
Did you mean: 

New Outlook VBO not picking up random emails

ToddMunkman
Level 2
Anyone else have this issue? It will pick up and read most emails, but randomly will leave one and never be able to see it. If I open and close outlook, it will then see the email? Very frustrating behaviour
4 REPLIES 4

david.l.morris
Level 15
Can you describe how you are retrieving the email, such as what action/inputs you're using? I haven't seen this behavior, but I'd like to try reproducing it. There can be some issues depending on the inputs you use, such as that I believe you have to give UTC date time for the date time inputs, and if you're trying to get by sender, it sometimes won't resolve the sender name/email properly. But even that stuff I haven't seen actually prevent retrieving the email, as it is more just that the inputs don't match the email. Let me know and I'll test it too with similar conditions to what you're doing.

Dave Morris, 3Ci at Southern Company

AmiBarrett
Level 12
I ran into this after I modified the Get Mail action to modify various mails on read. For example, mark as read/unread, move, task/untask. If one of the messages gets modified, the array of objects is dumped and refilled. For example. If you have it set to mark as read, but only pull unread messages, your array access will look something like this (in respect to the original array): 0,2,5,9 0th mail is marked as read, so get the info again. 1st mail becomes index 0, but your loop is looking at what's now index of 1 (and was previously index of 2). This is the only scenario I've seen it drop messages. If that's indeed what's going on, you need to modify it further to jump back to the construction of the loop and just keep hitting index 0 until no data remains.

AmiBarrett
Level 12

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.

ToddMunkman
Level 2
I'm not doing anything other than retrieving emails with the ""Get Received Items(Basic)"". This doesn't require any date time inputs, although you can use them.  The only inputs I'm using are Include Read  - False Include Unread - True Sub Folder - My Subfolder This works 99% of the time. However, randomly it will not see an email. This may only be one occur during a day. The only way I can find the email, is if I either open Outlook, or move the mail to another folder and back. Its like its in limbo. Makes zero sense. I find it absolutely backwards to add a process to open and close outlook, just to guarantee I receive all emails.