Rename attachment while downloading from the email

Hi I want to add the Id before the before the email attachment.
Like I have multiple emails and have a same name attachment. Now I want to save with the give the ID name before the file name. Hope you understand
Attachment Name in email: CandidateRes
I want to save it to give a specific id like 10001 CandidateRes
10001 value is stored in a variable which is changing dynamically. so want to add this variable with the attachment name.
@amarasto @HareeshMR
@lakshman Please help

1 Like

Hey @balkishan

You can use the id extracted and pass it in the folder path to save the attachment.Please find the screenshot below:Replace Period with the variable you are using to store the ID

1 Like

why I need to use the ID extracted, and from where I have to extract it? sorry not get you bro.
you gave the filename.csv???

1 Like

This is workflow look like, just I want to add this variable before the filename.
image

1 Like

This is for the illustration only.

ID is the id you extracted from the email subject you want to use in the attachment name.
so the path should go like this:

“D:/Folder/”+Id(your varaible name)+“_attachment.fileextension”

2 Likes

Ok.got It.

than change Subject +saveFolderPath to ID+Subject +saveFolderPath which should work.

2 Likes

I given like that only but didn’t work.
image

1 Like

Bro, I don’t have any ID variable, I have a subject variable which contain the ID value.

Hope you understand

2 Likes

Buddy
hope you mean like you want to save the attachement with a ID that makes it different in file name with the previous and next one
So we can add 10001 value stored in a variable which is changing dynamically
and to add that with attachment name in save attachment activity in uipath like this
"yourfolderpath"+IDvariablename.ToString+mail.Attachment.Name.ToString

Cheers @balkishan

2 Likes

what is this mail variable bro?

1 Like

oh
i think you are inside a loop so mention like this
saveFolderPath + Subject.ToString + item.Attachment.Name.ToString

make sure that saveFolderPath variable has value with \ at last
and i have one doubt is subject is the variable that has the value of Random ID
Cheers @balkishan

1 Like

yes exactly bro, can you see the below error screenshot.

1 Like

Why we have mentioned the Subject as a second string here
You said we need to concatenate the ID
@balkishan

2 Likes

it’s not a subject bro, just a variable it’s string type only. I extracted the specific content from the subject and it contain the ID. So don’t confuse with it bro.

1 Like

image

2 Likes

Fine
can i have a view on the xaml if possible, all together in a zipped folder
Cheers @balkishan

2 Likes

@Palaniyappan Please check below workflow.

Test.xaml (11.4 KB)

2 Likes

Hi assigned activity, so where to use this fileStream var.
As I used in the save attchement but it doesn’t work.
image

1 Like

@Manjuts90 How I did is it right ?

1 Like

@Raghavendraprasad can you guide this

1 Like