Save email attachments activity not creating unique file for duplicate Email attachment

Hi Team,

Save Email Attachment activity in side a for each email activity
I receive an error that a file already exists. But per the documentation of this activity, it will create a unique trailing number to the file “example _1.xls”

image

I have tried creating a new Dynamic Folder to prevent this error, but it still does not work.


image

I tried a different testing project with same file name attachments, and it seems to be working without creating a dynamic folder.

image

Can it be due to the “xls” extension?

Any suggestions?

Thank you

Hi @jaco

Create the folder in outside of the foreach loop and In Save Email Attachements activity check the Overwrite existing option. It will automatically override the existing file.

Regards, It may help you.

Hi @mkankatala ,

I dont want it to be overwritten.

It needs to create the trailing “_1” number, as the file name might be similar, but the contents have unique data.

Sorry @jaco. I didn’t get your question

An error is thrown saying there is another file that already exists.
I need the activity to create a unique naming convention to include both “named” files.

For example
data 04.05.2023.XLS
data 04.05.2023_1.XLS

image

@mkankatala or @Gokul001

Any thoughts about this?

Thanks Again for your help.

Is there a way to rename the attachments before its being downloaded, meaning before “Save Email Attachments”?

Hi @jaco

You can do one thing, first save the attachment and change the name of the file by using “Rename File” activity.
Before saving the attachment we can’t rename.

Hi @mkankatala ,

Thank you, Im trying but am a bit stuck on the variable side of the Save Email attachments

I gave the file “attachedFile” variable to be used in the “Rename Activity”

image

But I get an error that “source file does not exist”.

image

Hi @jaco

You have given the wrong source file name in the Rename file activity. You have given the Save Email Attachment activity output, this output is a collection not the file name. In Rename file activity you have to give the file path there.

I hope you understand!!

Thanks @mkankatala ,

But the rename activity is in a for each email loop, the File name/File Path is not fixed.

How will the process know what file to rename?

Thanks for helping

While you are using “Save Email Attachments” activity. The output datatype of the activity is IEnumerable it Stores the Retrieved file path from mail. Use for each to iterate the output variable. Refer the below image for better understanding.

I hope it may help you!!

Hi @mkankatala , thanks for this, will look at it soon and revert back.

Hi @jaco

If you get the solution for this query. Mark it as solution to close the loop.

Best Regards.

Hi @mkankatala ,

Here is my flow

I’m assuming that the “Mail” variable is from the Save Attachments output?
I used my “attachedFile” variable in my version.

But then I disabled the “Rename File” Activity and just ran the flow and it worked. No Idea why. Sorry, still learning.

image

Thank you very much @mkankatala

Great @jaco, Thank you for considering my answer.

Happy Automation!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.