Processing Unread Outlook Emails - Looping Issue

Hi,

I am trying to process all unread emails in my outlook inbox. How can I ensure that only one email is getting processed at any one time? I would like emails to get fully processed before processing the next unread email. See PDF attachment for a pictorial diagram of intended flow.

I’ve attached my project so far. Any assistance would be much appreciated.

Many thanks,

Jeff

UI Path Issue - Looping Issue.pdf (168.5 KB)

Main.xaml (66.8 KB)

Hi @JeffNZ ,

Instead of manually recording the process of reading mails, try using the inbuilt activity.

Follow the steps and you should be fine.

  1. Use Get Outlook Mail messages which saves all your emails in a variable.
  2. Loop through the variable using for each and do the necessary calculations you need.

Thanks

Hi,

Thanks for your speedy response. In my attached project I have already called the messages variable in my main for each step - process unread emails. Is this what you were getting at? If so I’ve probably mucked it up :slight_smile:

Regards,

Jeff

image

This is how I loop through each unread emails and it works fine for me. You have self looped the last sequence which is not needed.
Hope this helps.

Thanks

Hi,

Thanks for your response once again. I have removed the self loops but I’m finding that UI Path does not consistently follow my flow:

  1. Identify unread mail
  2. Identify if mail has an attachment - if no attachment go down no attachment path and perform steps 4 and 5 below.
  3. Identify if mail has a PDF attachment - if not PDF go down no PDF path and perform steps 4 and 5 below.
  4. Message box pop up
  5. Move processed mail to different folder

Sometimes the processed mail has been moved before the message box pop up step which is proving to me that UI path is not processing one mail at a time. Is there anyway to control the flow to perform the steps in the order defined every time?

Many thanks in advance,

Regards,

Jeff

Hey @JeffNZ,

Can you share your updated workflow and I can have a look at it.

Thanks

Hi,

Many thanks for your response once again. My updated workflow is attached,

Cheers,

Jeff

Main.xaml (65.2 KB)

Hey @JeffNZ ,

For some reasons I cant see the activity of process unread emails. Its because of the version changes.
Few question

  1. Why do you need to open Outlook using recording?
  2. Why search for unread emails as your read outlook messages activity is reading only unread mail

Also I have attached a sample workflow to guide you. Please edit the paths and folder as per your requirements.
Main.xaml (14.5 KB)

Hi,

I’ve attached a document which details the activity of process unread emails. Please let me know if I’ve missed any detail. I’m now encountering a problem where in my non-PDF email workflow path the processed email is getting duplicated :worried:

I think my workflow is very similar to yours. I’ve taken out the open outlook and search for unread email steps - they were included because I didn’t know any better :slight_smile:

Regards,

Jeff

UI Path Issue - Looping Issue Additional Detail.pdf (292.6 KB)

Hi @JeffNZ,

I don’t think there is much processing in non pdf path. But I would suggest that you use debug mode to see why the mails are being duplicated. One of the reason could be you have used parallel for some processing. But that’s just a guess. Debug it step by step to find out the details.

Thanks

Hi again,

Just further to my duplicating issue I’ve noticed that the attachment in the problem email is embedded. If you think I should treat this as a seperate issue I will start a new post.

Regards,

Jeff

Yeah I guess check existing posts on forums. Probably you can read the body and try to retrieve the image. But I am not much aware of that. Let me know if the previous issue got resolved or not

Thanks