I am absolutely new to the tool. I have a need to extract attachments from a folder in my inbox. Its a folder that gets daily reports. Those reports do not have the date time mentioned in the attachment name, hence I need to download the attachment after renaming them with the mail received date.

I have searched and none of the solutions are exactly matching my ask. Almost all of them are talking about "When a new mail arrives", whereas I need to parse through each mail that is already in this folder.

I am unable to figure out how to rename the attachment with the received date in a loop.

Formula for the Compose piece:

concat(formatdatetime(triggerBody()?['DateTimeReceived'],'yyyy-MM-dd-hhmm - '),item()?['Name'])

Here is what I have so far:

enter image description here

1

Best Answer


I assume you want to receiveddatetime property of the email? Within the expression you are referring to a property from the Manually trigger a flow action.

However, the details of this property are in the Get Emails (v3) action. You can refer to the receiveddatetime property by using the items() function instead.

Try this expression:

concat(formatdatetime(items('Apply_to_each_2')?['receivedDateTime'],'yyyy-MM-dd-hhmm - '),item()?['Name'])