I need to check if a certain subfolder exists in the main folder “Inbox” in Microsoft Exchange before proceeding to move mails to it. I am trying to use custom activities for it, but so far I’ve faced errors. I tried using “microsoft.exchange.webservices.data.folder” but it does not work. Can anyone give me the exact activity or solution required? I want to use Assign.
I don’t know of any activity that can do this directly. I think I’ve seen similar forum topics asking for this before.
What you might do is put ‘Get Exchange Mail Messages’ activity in a Try-Catch block. If it ends up in an exception, you’ll know that the folder does not exist.
Alternatively, a better approach may be to establish a business rule exception which is “handled” such that the bot tries ‘Move Mail Message’ activity and if it fails, it is assumed that the folder doesn’t exist (or look for a specific exception in the catch block through trial-and-error). And then the message can be moved to a ‘Default’ folder which you definitively know exists.
This folder can later be cleaned up by a manual review team to decide where to move the failed messages.
As you say no activity can handle this (in general Exchange Activities in UiPath need a little bit of a review… my opinion). What I did was to write a code in C# (invoke code):