cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JoelH
Level: Powered On

Get file extension name of outlook email attachment

I'm building a flow where I read email attachments of an email from outlook, renaming each one, and saving the renamed attachments into a sharepoint library. 

 

But how do I get the file name extension of my attachments? I was hoping it was available somewhere inside the Apply to each Attachment on the email action, however I only find the (Attachment)Name property. 

 

I tried some different things, but couldn't solve it. Anyone know how to achieve this? For now, I have hard coded the extension but I'd like to just rename the attachment and keep the extension as is.

 

EmailAttachmentGetExtension.png

2 REPLIES 2
Community Support Team
Community Support Team

Re: Get file extension name of outlook email attachment

 

Hi @ JoelH,

 

How would you rename the attachments?

 

I have made a test on my side, please refer to workaround below.

  1. Add a trigger “When a new email arrives”. the “Has Attachment” field and “Include Attachments” field both set to “Yes”.
  2. Add an Apply to each, choose the “Attachments” dynamic content of the trigger in the input field.
  3. Inside the Apply to each, add a Compose, choose the “Name” dynamic content of the trigger in the input field to get the attachment name.
  4. Add a Compose2, add an expression below to get the attachment extension name: 
substring(outputs('Compose'),indexOf(outputs('Compose'),'.'),sub(length(outputs('Compose')),indexOf(outputs('Compose'),'.')))

 

     5. Add a Compose3, add an expression below to get the attachment name without the extension name:

      

first(split(outputs('Compose'),'.'))

 

    6. Add an action “Create file” of Sharepoint connector, fill in the Site Address and Folder Path field. You could name the file as me,to combine the “Output” dynamic content of the Compose3 and “(copy)” as the file name, and choose the “Output” dynamic content of the Compose2 as the extension name of the file, Then choose the “Content” dynamic content of the trigger in the File Content field.

 

 1.png2.png

   

When receive an email with attachment, the flow run successfully as below:

 

3.png

 

The screenshot of file in my sharepoint as below:

4.png

 

 

 

 

Regards,
Alice Zhang

AdolfoGea
Level: Power Up

Re: Get file extension name of outlook email attachment

Perfect!! Thank you.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 82 members 4,970 guests
Please welcome our newest community members: