How to only print attachments and not include embedded pictures in Outlook

email
activities

#1

Hello,

I am trying to make a workflow where I print out all the attachments in a mail, using get outlook mail activity.

It works fine until I get an email where someone have attached let’s say 5 PDF files, and embedded one picture (company logo etc.) into the mail.

UIPath seems to think that it is now 6 attachments, and it tries to download one “extra”.

The reason why this is a problem is because I can’t use the “save attachment” activity. I am not going to save them, I want to print. So far my program can print all emails that doesn’t have these embedded pictures in it. Is there a way I can exclude these files?

I am currently using a click button with a variable in the selector. So that it will click whatever attached file with the name “attachment.Name” variable.

UIPath version 2018.1.2

Thanks in advance.


#2

I guess you can try to save all the attachments in a string variable. Then, in the Mail sender activity, paste that string.

It should work.

Greetings


#3

@Pablo_Sanchez

Hm, I’m not sure that I follow.

I want to only print out the attachment in the mail. I’m not going to send any mails. Only receive and send to the printer.


#4

Maybe I don’t understand, but, do you want to print all the attachments right ?

So, you can read one, save it in a string variable. Then, with the 2nd, you do the same adding the new attachment to previous string. In that way, you will have a variable with all the attachments that you have read.

Is that what you want? Maybe you are asking for something else… sorry if I’m answering wrong.


#5

In you case did you try saving/printing only PDF attachments?

create a variable downloadAttachment of type MailMessage.Attachments

downloadAttachment = email.Attachments.Where(Function(s) s.Name.Contains("pdf"))


#6

This could work. Thank you, I will try


#7

@vvaidya Thanks vvaidya. I solved it with "attachment.name.contains(“pdf”).

Another question:

If someone send me an email with two attachments with the same name. How can I differentiate between these?
As of now I use the name of the PDf file to click on the name attribute in the selector. But if I have two files with the same name, my current program would click on the same file because it wouldn’t recognise that it were more attachments than one.

Any ideas?


#8

Quick question : how are you Printing the attachments, by opening the Outlook and clicking on attachment?


#9

Yes, that’s the only way I found possible


#10

This option in Outlook Print doesn’t work for you?

image


#11

Yes. But I would still have to loop each mail in the inbox. And manually click on “file” -> “print” -> “print options” -> “print attached files” etc for each mail?