How to save perticular file from outlook, when the attachments contains multiple files

Hi @andrzej.kniola and @aksh1yadav,

Thanks for the solution, Its working fine for me.

Thanks & Regards
Punee

Hi All,

We will appreciate you if you give us exact solution file(.xaml)

Thanks,
Sandy

It is already there. you can download it

Or you are asking for other thing?

Regards…!!
Aksh

Hi @aksh1yadav,

I tried using your xaml. It’s unable to find the attachment.
Also, when I save the mail messages, every field of the mail (including attachments) is empty, except the subject.
Any idea on this?

Hi @aksh1yadav,

I also tried your xaml but I am also facing same issue as like @Sriv is facing.

Please find below screen shot of email

except the subject all things are blank.

Is there any dependency of UiPath version currently I am working on latest UiPath version(Version 2016.2.6274)

Thanks,
Sandy

This Still works with my enterprise account email. Do not know but may be enterprise security issues. many others also faced this and they were saying the same.

Will you give it a try on your personal laptop or system with outlook and let us know the outcome of it. Will be helpful to identify problem in your case.

Regards…!!
Aksh

Hi,

Use Filter Property of the “Save Attachment” activity.

How to use filter?

Hi @sanjay.erram,

Hi, this filter will also download files that include “xls” in the filename, so for instance “xls-test.exe” will be downloaded where as “legit-file.xLs” will not.
To make the filter case-insensitive, apply this filter: “.*(?i)(.xlsx|.xls)”

I do not know how to specifically and only filter xls/xlsx files, that only examines the file extension. :frowning:

1 Like

Hi, I have implemented your code in a loop of emails, each email will save the attachments and doing so, I have encountered this.

Filter Emails: Process Email: Invoke workflow file: Invoke method Stream : Cannot access a closed Stream.

I have remove the line of code where in you dispose the stream and filestream, question, In uipath, what will be the implication doing so?

Hey @marcus

If a class implements IDisposable, then you should dispose it so any resources gets closed/cleaned up asap instead of relying on the garbage collector.Classes such as Stream, StreamReader, StreamWriter etc implements IDisposable interface h that means, we can call Dispose() method on objects of these classes.

Regards…!!
Aksh

Because you were disposing that stream object inside a loop so when your loop was processing second time the stream object you already have been disposed. so make that part outside of your loop. :slight_smile:

The contract for IDisposable.Dispose explicitly requires that calling it on an object which will never be used again will be at worst harmless.
I would recommend(Personal point of view) calling either IDisposable.Dispose or a method called Dispose on every IDisposable object if you don’t wanna use that object again :slight_smile:

Regards…!!
Aksh

Hi,

I tried using ur attached workflow and its working fine. I just wanted to know tht why are we using the invoke function in this? What is the use of them?

Thanks in advance.

Hello,

Is it possible to check if the attachement name contains a certain fileformat (example: .xlsx), if not return the email with the attachement?

I then need to get the senders email as well

Attached workflow was executing fine for one email with specified extension,if multiple mails are present with same extension of attachments then attachments are not getting saved.OutLookAttachement.xaml (16.1 KB)

1 Like

Hi @aksh1yadav,

This works great. But could you explain how does the attStream CopyTo method know where to copy to? I don’t see the direct connection between attstream and folderpath… Also, why do we put this invoke method outside the if folderexists sequence?? Thanks a lot!

Regards,
Lavina

1 Like

Hi Aksh :slight_smile:
I know this is a good solution, but could you please show me how to set this kind of filter in the Get mail messages (there is in fact a “Filter” field, I just don’t know how to use it) to filter them if they have attachment that contains .xls or .xlsx?

thank you in advance…