Save attachments activity

email
activities
attachment

#1

Hi All,

i have saved all the attachments from a mail using save attachments activity but now i want to store these attachments in different folders by extracting one pdf at a time.


#2

Try this:

  1. You can get the files in a string array
    String[] getFiles = Directory.GetFiles(attachmentPath)
  2. Then you can loop each file in the getfiles array and identify the extension of the file.

foreach filevalue in getFiles
{
if( Convert.ToString(Path.GetExtension(filevalue)).tolower.Equals(".pdf") = true)
{
//then move activity to move the file to another folder
//source path = fileValue and targetPath as the new path where you want to store the file
}
}


#3

its not working throwing an error when i am putting a condition in if clause


#4


#5

Hi its working now but after that i am not getting what to do what activity to use to save these files.
Please let me know


#6

after that in then use move files activity to move the pdf to another folder.

Also update this as if( Convert.ToString(Path.GetExtension(filevalue)).tolower.Equals(“pdf”) = true)


#7

again throwing an error cz its not able to find the source file


#8

even i am trying to concat get files variable also in source file so that it can identify the path but the value variable in for each activity does not return only the file name it returns the entiire path along with the file name so have to remove the rest of the path from value variable which we are getting from Directory.getFiles


#9

From will be file that you want to move … in this case it will be value variable of for each … Target will be the path of new file location