Studio X - Download email attachments to created folder

Hi All,

Every day I run a process to look for specific emails and download the attachments for the current day. However, I want to set a condition that it only creates a folder for them to be saved if there was an attachment to download.

Is anyone able to assist?

  • One folder for all downloaded attachments

Hi @Fabs

you can replicate the flow as per below. It should help you.
In the set variable value give the below syntax:

folderPath= Path.Combine("C:\YourBaseFolder", "Attachments", DateTime.Now.ToString("yyyy-MM-dd"))

Change the path according to yours.

Regards

Update: There will always be a report but I only need to create a folder for a particular day, so I was able to resolve as the following:

If(DateTime.Now.DayOfWeek = DayOfWeek.Friday, “YourBaseFolder” & DateTime.Now.AddDays(-1).ToString(“ddMMyyyy”), “”)

In this example, if today is Friday it creates the folder with yesterday’s date (as required) and it saves the attachments to the create folder.

What I need now is that if today isn’t Friday, to do nothing. The current error I get is:

If(DateTime.Now.DayOfWeek = DayOfWeek.Monday, “YourBaseFolder” & DateTime.Now.AddDays(-1).ToString(“ddMMyyyy”), “”)

image

Are you able to help?

If(DateTime.Now.DayOfWeek = DayOfWeek.Friday, “YourBaseFolder” & DateTime.Now.AddDays(-1).ToString(“ddMMyyyy”), “Nothing”)

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