@Tacurwick You haven't defined a file extension in the Create a file action.
Get the File Extension
You can get the extension of the file from the Attachment Name.

You can add Compose actions to your Apply to Each action to extract that information. The first Compose action is optional (however, if you are new to Power Automate—it'll make it easier to build the expression in the second Compose action).

In the first Compose action, insert the Attachments Name dynamic content.

In the second Compose action, you are going to build an expression with two functions:
- split() to split the attachment name at the period.
- last() to get the extension after the attachment name has been split.
Start with the split() function. The split() function takes two parameters:
split([string to split],'[separator]')

Switch to the Dynamic content tab and insert the outputs from the Compose action that has the Attachment Name.

Add a comma and single quotes. Between the single quotes insert a period.

This action will split the Attachment name at the period into an array. To get the last item in the array (aka the file extension) you need to wrap the entire expression in the last() function.
Got to the start of the expression. Tip: Press the up arrow key.
Insert last (

Go to the end of the expression. Tip: press the down arrow key.
Insert a closing bracket.


Run a test. Click on the Compose action to view the Outputs. Confirm that the extension of your attachment(s).

Create File
Add a Create File action. Ensure that you are inserting a period before you insert the outputs from the Compose action that contains the file extension.

Insert the Attachments Content dynamic content in the File Content field of the Create File action.

Hope this helps!
If I helped you solve your problem—please mark my post as a solution ✅. Consider giving me a 👍 if you liked my response!
|