Check if folder is empty in outlook?

How can I check if folder is empty in outlook? If not possible then, is there a way to check “Get outlook Mail Message” activity output is empty or null

1 Like

As you are going to store the output of get mail message activity in a variable (Assume as messages), @harsh_mengar

You can check the number of mails you have retrieved from the outlook using

messages.count and it will give you the number of mails retrieved :slight_smile:

Fine
Welcome to uipath community
—so use a get outlook mail activity with onlyunreadmessage and markasread property unchecked and with no filter and the folder name as “Inbox” or in specific folder “Inbox\yourfoldername” and TOP property mentioned as 50 (any random value but Lesser just to be more than 1)
—get the output with a variable of type list (of system.net.mail.mailmessages) named list_mailmessage

—now use a if condition like this
List_mailmessage.Count > 1
If it’s true then we got some mail in our outlook mail box with the mentioned folder and will go to THEN part
Or it will go to ELSE part

Hope this would help you
Cheers

Thank you. It worked, I want to suppress message/error popup box. Is it possible to avoid that?

yah instead of message box we can use CALLOUT ACTIVITY
which will popup and go after certain amount of time
for more details

or if we dont want the popup itself we can simply use WRITE LINE activity or LOG MESSAGE activity which will help us to see the output message in the output panel of the studio

hope this would help you
Cheers @harsh_mengar

The popup box appears because of terminate workflow, I want to avoid that

Fine you want to avoid terminate workflow popup in that case
this thread would help you for sure

Cheers @harsh_mengar

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.