I have attached my .xaml file where I am getting emails with attachments and checking to see if the attachment contains special characters. If the attachment contain special characters, I want to rename the attachment and send the new attachment to an email address. I do not know how to rename the attachment. The new name should be “newname” + today’s date + extension name of original attachment"
Renaming can be done with the move activity file. Simply change the Destination property to be the full file path you want.
So steps to take would be:
save all attachments to folder such as C:\Temp\MailAttachments (have to save them in order to rename them)
In a for each loop (of type string): For each file in Directory.GetFiles(“C:\temp\mailattachments”)
a. Use a move file activity: From path = file // To Destination = Path.GetDirectoryName(file) + "" + “newname” + today.ToString(“MM-dd-yyyy”) + Path.GetExtension(file)
Add all files in the directory (C:\temp\mailattachments in this example) as an attachment to your mailmessage
Run the garbage collector to dispose of the mailattachment after the email is sent
Delete the files in your directory after the email is sent
Thank you. I appear to be having a problem with choosing the correct object type in the for each loop, i.e. I am getting this error in the destination path of the new file: