Download attachments from emails with a specific subject

Guys i am trying to download attachments from emails send to me with a specific subject .Help me as i see no options to dwnload attachments

2 Likes

https://www.uipath.com/activities-guide/save-attachments

You can do like this way in screenshot. replace your subject text with “\number” part.

Regards…!!
Aksh

8 Likes

thank you @Phiggins and @aksh1yadav

Hi, can you please provide me the details of the variable ‘Mail’? I am not sure what this needs to contain? What should the default value be? Thanks!

Hi,
I am able to download the attachment but when another application is trying to invoke excel file it is throwing error
“Excel application scope : Excel cannot access ‘Desktop’. The document may be read-only or encrypted.”

Please suggest how can we solve this issue?

Thanks,
Anjali

Well check the path you are giving a file name along with desktop path? or just Desktop and other possibility is check that excel file is password protected or not. if so then pass the password also in Excel application scope properties.

Regards…!!
Aksh

Hi,
I have provided correct path to download the excel file, the issue is with OPENING that excel file, and also the file is not password protected.

Thanks,
Anjali

Then please cross check the path you are passing in Excel application scope. try to write line it and observe the path.

I don’t want to hardcode the path.

is it not possible to have the path which I am giving (C:\Users\anjmishra\Desktop) plus the excel file name (Details.xlsx)
C:\Users\anjmishra\Desktop\Details.xlsx?

Hi @anjalimishra,
To determine the path of the desktop where the robot is running you can use:
Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

Actually I assigned this to a string variable called folderPath and inserted the following command in Excel application scope.
folderPath + “Details.xlsx”

I hope that helps!

Hi,

I try to do like this but I get always an error and I don’t know what im doing wrong.

Image bellow

Can anyone help please. Thanks

Hello,

Well I find a solution to my problem, the filter must be done like the example on this page

“@SQL=”“urn:schemas:httpmail:subject”" like ‘Subject That you like to search’"

I hope that helps someone.

Thanks

Well the problem is because you are not getting result count to process so.

Regards…!!
Aksh

Hello,

The solution is simple actually. You have to:

 Select the For each activity > Go to TypeArgument attribute on the menu > Choose  System.Net.Mail.MailMessage from the list 

That should solve the problem.

2 Likes

Hey I am also looking for the same. Any idea regarding the mail variable?

hey, I am also looking for the same. I have to download the attachment inside a mail with a particular subject. I tried giving “/number” but no luck. Can you please help me out? attaching the workflow.email.zip (5.3 KB)

@amithvs i Changed ur xaml file. check it once Mail_Trigger_Sample (1).xaml (22.4 KB)

but body of the mail is showing like this.
image

@amithvs,Use Regex
Regex.Replace(item.Body, "<[^>]+>| ", string.Empty)

1 Like