Download and read attachment from e-mail

Dear Community,
I am having problem with the following activity
1.download pdf or excel attachment from e-mail and store in a specific folder.
2.read the attachment content and save in a txt file.

Both the activities are possible individually but how to combine these two?

1 Like

after downloading all the files
loop through the files and read them and add to text file!

1 Like

Hi
Hope these steps would help you resolve this
—use GET OUTLOOK MAIL ACTIVITY where get the output variable of type list of mailmessage named list_mails
—now use a FOR EACH activity and pass the above variable as mailmessage And change the type argument as System.Net.Mail.Mailmessage

—inside the loop use a Save attachment activity where mention the input as item in mail property and in the folder path mention the path where we want to save the file

—then next to this save attachment activity use a Assign activity like this
arr_pdffiles = Directory.GetFiles(“yourfolderpath”,”*.pdf”)
And
Another assign activity like this
arr_excelfiles = Directory.GetFiles(“yourfolderpath”,”*.xlsx”)

Where Both are variable of type array of strings

—now inside this loop use another FOR EACH loop and pass the input as arr_pdffiles and change the variable name from item to pdf
Inside the loop use READ PDF or READ PDF with OCR as input and get the output with a variable of type string and write that to a text file with WRITE TEXT ACTIVITY

—next to this for each loop use one more for excel files (while still being inside the loop that is iterating the mailmessage)
Where pass arr_excelfiles as input and change the variable name from item to excel
same use excel application scope and read range activity, get the output as datatable
Where now pass this datatable to OUTPUT DATATABLE activity and get the string which can be passed as input to Write text file activity

Cheers @ADITYA_MUKHERJEE

2 Likes

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