How to mark a given email as read?

Hi,

Is there any activity to set a given email message as read?

In the preinstalled standard activities there is no activity that does this action.
Is there any package available containing such activity?

Or how have you been handling such kind of situation?

1 Like

When you retrieve the message, it has an option to mark it read.

Yes, Iā€™m aware of that.
Nevertheless I want to mark an email address only after doing some processing.

For your current situation you can achive results using following steps

1.Read all unread mails -do not mark them as read
2.do processing and filter mail that you want to mark as read Get unique identifier from mail such as sender ,subject (use combination for better results).get these in datatable
3.now loop datatable , use read mails activity with read mail option true and use unique filter

Regards,
Aditya

3 Likes

@rahatadi, thanks for your reply.

Imagine I have only 2 unread emails.
I will make some processing on the 1st email and if the processing has been done correctly I want immediately after mark that email as read. Only aftewards I will go to the 2nd email and process that 2nd one. And will mark afterwards that 2nd one as read, if the process on the 2nd one has been done correctly.

@jcab

Refer this post

2 Likes

That invoke code activity does not work. I already saw this info and tried it last week.
ā€œUnreadā€ is not a class belonging to mail message objects.

@jcab,

i have simulated your condition with smallest possible way and so there are many things which we can improve in process.

i am using outlook for this.

Main.xaml (7.2 KB)

let me know if anything is unclear about process

br
aditya

Thanks @rahatadi, but thatā€™s really not what I want, because I initially get all the outlook messages using a given filter. Meaning that Iā€™m unable to set a specific email from that filter group as read.

As a workaround Iā€™m changing the status of the processed email message as ā€œCompletedā€, instead of setting it as ā€œUnreadā€.

could you send some more details of your case ? it seems to be more inserting to meā€¦lets see what we can do together

@jcab

you can try this vb code

Const olFolderDeletedItems = 3
Dim Items
Dim objSubject
Dim Arg
Set Arg = WScript.Arguments
Set objOutlook = CreateObject(ā€œOutlook.Applicationā€)
Set objNamespace = objOutlook.GetNamespace(ā€œMAPIā€)
'Set objInbox = objNamespace.GetDefaultFolder(olFolderInbox)
Set objInbox = objNamespace.Session.GetDefaultFolder(olFolderDeletedItems).Parent._
Folders(ā€œInboxā€)
Set Items = objInbox.Items
Items.Sort ā€œ[Received]ā€,True
MarkEmailUnRead(Items)

Sub MarkEmailUnRead(objItems)
For Each objItem in objItems
objSubject = Arg(0)
objsubject = objItem.subject
if Instr(objsubject,objSubject) <> 0 then
objItem.UnRead = True
objItem.Save
Exit For
end if
Next
End Sub

save above code as .vbs
and use start process with mail subject as argument
image

Hello @jcab,

I also struggled for this scenario and I created a custom activity package that has mark as read/unread mail message activity.
https://go.uipath.com/component/outlook-mail-activities-4dbc88

I hope it will be helpful to you too. I would be happy to get a feedback on the activity if you try it.

Thanks.

3 Likes

Thanks !

Do you have any documentation on how to us it?

In UIPath version 2021.4.4 you have the activity ā€˜Mark Output Mail as Read/Unreadā€™

Unfortunately, this activity seems not working correctly on IMAP mailboxes

Hello @jcab,

Try this solution, it may be helpful for you.

How to mark email as unread after doing some process - Help - UiPath Community Forum

Thanks,
Navneet
Happy Automation :slight_smile:

Hey can you help me to filter get outlook mail message activity by PArticular email id ? And mark them as read after saving the attachment ?