'Get Outlook Mail message'. I am using this activity to extract attachments. how to mark the mails as unread if there is an exception and attachment fails to download

In my flow, the bot checks the inbox and downloads attachments for unread mails and marks them as read, ‘Mark as read’.
Now if there is an exception in between and it fails to download attachments from the new emails then I want to rerun the process. While rerunning, since the mails are marked as read already they are not detected.
How to mark the mails as unread in Outlook automatically?
Any help would be appriciated.

@SWATI_KAROT Where would the Exception appear in your case?

Exceptions like Outlook does not give permission to the bot to access info. Or Multiple instances of outlook open. Or if the Outlook process is not running.
Exception can be anything, but how do we revert the changes done by ‘Get Outlook Mail message’?
Like revert read and unread status on email.

@SWATI_KAROT I don’t see that as an easy task, or if it is even possible to Make it unread after they have been Marked as Read. I guess one possible Solution is to Create a new Folder called “Exception”. Handle the Exception using Try Catch and Whenever an Exception occurs you can move that Mail to “Exception Folder”. Then you can retrieve the mails in that folder when needed.

@supermanPunch Hi Arpan,

I am relatively new to UIpath, with exp of 2 weeks only, I was reading about queue in Orchestrator. can we implement the above scenario in Orchestrator and move such mails in pending queue? Again its just a thought, i have no idea how to implement this.

@SWATI_KAROT Yes, We can do that also. But it won’t be Stored as in How the mails would be stored in the Outlook Application. The Exception mails can be added to the queue using Add Queue Item Activity, You can also access or get the items from the queue only Once. If you want to access the Exception mails again then it won’t be available Since it is already retrieved once.

But Can you tell me what would you want to do with the Exception Mails ?

We would also have to Serialize the mail to String to add the mail to queue, and deserialize it when it is retrieved.

@supermanPunch, I just want the email attachments from the mailMessage object.
Basically I am getting the attachment, doing a document understanding, and exporting to excel.

If there is an exception after getting the attachment and before exporting to excel. In this exception queue I want to capture such attachments.
And in the next run, process them again i.e. perform document understanding and export to excel.

@SWATI_KAROT But I thought you want to handle the Exception during the Get Outlook Mail Messages or During the Save Attachments :sweat_smile: Is it after the Save Attachments Activity that you want to handle the errors i.e during the document understanding Process ?

@supermanPunch. Sorry for not making it clear before. Yes I want to handle after the attachemnt is downloaded and saved. So basically we are free from this Outlook thing. We just have this set PDF documents.

But the ‘flag’ to differentiate which PDF document needs to be re processed and which has completed processing is present in Outlook i.e. the ‘read’ and ‘unread’ status of email.

Also, I am super confused right now.
Although, Get outlook mail activity provides a check box to ‘mark as read’. I can disable that. so all mails will be unread irrespective of processed or not processed. But still how will we differentiate it in the attachments?

@SWATI_KAROT Instead of processing the mails can you not just process the Documents received. Like if the Document gets an Exception move the Document to a Different Folder say Exception Folder in your System

@supermanPunch. I think i will have more clarity once I implement some of your suggestions. Let me try this out and get back.
Thanks :slight_smile:

1 Like