cancel
Showing results for 
Search instead for 
Did you mean: 

MAPIEx - Loop through emails

jonathan_mak
Level 3
Hi, When I use the "Get Mail" Action I am only able to retrieve the most recent email in the inbox. Is there any way to loop through the emails in the inbox using the MAPIEx object? Any help is appreciated, thanks.
3 REPLIES 3

Denis__Dennehy
Level 15
I built a background email processing process once - it uses Get Email to get the next email, do some validation to ensure it was a valid request, and then added that email to the work queue before getting the next email. Invalid emails were moved to an invalid email sub-folder, valid emails were moved to a loaded sub-folder. Each process that was fed via email requests had its own mailbox.

Hi Denis, I appreciate the feedback. This is exactly what I want to do, process the email and add it to a work queue but how were you able to achieve ""Getting the next email"". When I run the Get Mail action multiple times, I would only be retrieving the same (most recent) email. Was it because you moved the emails to a separate folder? Is there any way to do this without moving the emails.

Denis__Dennehy
Level 15
Yes - Processed emails should be moved into a sub folder called something like 'Loaded' - otherwise your mailbox polling logic would be very inefficient as it constantly reads in emails it has already loaded and checks the work queue for duplicates. Also, anyone looking at that mailbox would have no idea what has been loaded into Blue Prism and what has not been.