How To Download Specific Files From A Mail – In UiPath

Mails are something that is widely used in the automation processes to receive inputs and to notify the users using the process.

UiPath provides us the facility to download the attachments from particular mail.

By default, it downloads all the attachments available, but what if we are planning to download only specific extension files?

Let’s see how to do that!!!

Filter = “.*(.xlsx|.XLSX|.xls|.pdf)”

Note:
Pass the EXTENSIONS according to your choice


Example

Let us implement a workflow that read emails from an account and then download the attachments according to our requirement.

Step 1:
Drag “Get IMAP Mail Messages” activity into the design panel and populate its properties with required fields.

UiPath Reverse a mail list 1UiPath Reverse a mail list 2.PNG

Step 2:
Drag “For Each” activity into the design panel and pass the above “newMailList” variable to it and change the type in the properties window to “System.Net.Mail.MailMessage

UiPath Reverse a mail list 4.PNG

Step 3:
Drag “Message Box” activity into the For Each activity and pass the “item.Subject” value into it to display the subject.

UiPath Reverse a mail list 5.PNG

Step 4:
Drag “Save Attachments” activity into the For Each activity just below the Message Box Activity and pass the required fields as shown below.

UiPath Download Specifi AttachmentsUiPath Download Specifi Attachments 2

Step 5:
Finally, when we run the bot!!!
We should be able to download the files as per our defined criteria.

UiPath Download Specifi Attachments 3.PNG

Click here to download the Source Code…

Hope it has helped you…

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: