Download attachments from emails with a specific subject


#1

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

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


#3

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

Regards…!!
Aksh


#4

thank you @Phiggins and @aksh1yadav


#5

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!


#6

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


#7

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


#8

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


#9

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


#10

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?


#11

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!


#12

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


#13

Hello,

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

https://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._items.find.aspx

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

I hope that helps someone.

Thanks


#14

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

Regards…!!
Aksh


#15

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.


#16

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


#17

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)


#18

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


#19

but body of the mail is showing like this.
image


#20

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