Name file change method

How can I change the name of a file by assign method?


Try with the Invoke Code activity and call System.IO.File.Move method to rename the file.

System.IO.File.Move(“origFileName.txt”, “newFileName.txt”)

You can’t use the System.IO.File.Move method in an Assign activity because this method does not return a value and the assign operation requires an expression that can be evaluated and then assigned to a variable.

1 Like

Yes, but I want to change a name file, don´t knowing is name, Just saving the new name on a variable, and then change the name for various files, for example: file_1,file_2,file_3 …

HI @fabiosantos_99,

use copy File activity to copy the file from one folder and paste it into another folder there you can change the file name.


Destination you can change the path and file name

Refer this


Thanks for your quick reply,

I´m already using the save mail activity, doesn´t have a activity to move and to be possible change names to??
And I don´t even know the name file, so I think I can´t copy it without knowing is name…

Are you using Save Mail Message activity and then you want to rename the file? Then you can use the new name directly for FilePath property.

Or are you saving the email attachments using the Save Attachments activity? In this case you can get the file names using the Attachment.Name property.
For example, the name of first attachment in the first email of your collection would be


Thanks for the quick reply,

Yes, I saving attachments, but not just 1 or 2, I want to create diferent names for diferent mail attachments, and then would be more easy to do the rest of the program.

1 Like

thanks, it helped.

1 Like