web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Saving and renaming em...
Power Automate
Answered

Saving and renaming email’s attachment to a SharePoint library

(0) ShareShare
ReportReport
Posted on by 12

Created my first PA Flow, and it seems to work ok, but the files extensions are missing. It’s a very simple flow: Saving and renaming email’s attachment to a SharePoint library. The attachment gets saved and renamed… but it loses the file extension.

 

I have searched the Community, a found one post like what’s happening to me. But the solution of adding .pdf at the end of the File Name doesn’t seem to work. It created the file with a .pdf extension, but I can’t be read.

mmx9000_0-1671211509914.png

 

The email’s attachments are .pdf, so I’m not trying to cover the attachment into pdf, just want to rename it, and keep it as pdf.

 

This is the post I was referring to:
https://powerusers.microsoft.com/t5/Using-Flows/Missing-attachment-file-extension-when-creating-file-in/m-p/1348873 

 

Screenshot of my flow:

mmx9000_1-1671211693313.png

mmx9000_2-1671211738910.png

 

Thanks, in advance! 

Categories:
I have the same question (1)
  • mmx9000 Profile Picture
    12 on at

    Thanks everyone for the help! really appreciated it. 🤗 Thanks!

  • mmx9000 Profile Picture
    12 on at

    Adding this Expression worked, thank you! the file gets rename with the subject line and it also opens just fine.

  • Kabilesh Profile Picture
    177 on at
    Hi @mmx9000 

     

    Hope this helps

     

    Kabilesh_0-1671772782866.png

     

    Kabilesh_1-1671772833643.png

     

    Kabilesh_2-1671772850479.png

     

    If you want both subject and attachment name as file name , use this instead of val2 in file name: 

    concat(variables('val2'),'_',split(items('Apply_to_each_2')?['name'],'.')[0])
     

    Best Regards,

    VK

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



  • Verified answer
    cbasolutions Profile Picture
    9 on at

    To do what you want to do, you can run the an Expression on the name. I would also suggest replacing any spaces in the name in case there are unwanted characters at the end. 

     

    concat(replace(triggerOutputs()?['body/subject'],' ','_'),'.pdf')

     

     

  • mmx9000 Profile Picture
    12 on at

    Thank you VK. What you subjected works for me too... But I need to have the attachments rename with the email's subject line. 

     

    Thank you!

     

  • Kabilesh Profile Picture
    177 on at

    Hi @mmx9000 ,

     

    Hope this helps you ,

     

    Kabilesh_0-1671733487667.png

    Kabilesh_2-1671733720975.png

     

     

    Kabilesh_1-1671733501719.png

     

    Best Regards,

    VK

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

  • mmx9000 Profile Picture
    12 on at

    Thank you for answering Scott. I tired adding the (Get Attachment v2) and the (Compose) but the Flow fails when I test it. I must be missing something at the (Get Attachment v2). I also wanted to ask; do I still use the (Create file) right?

  • ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @mmx9000 

    If you add a Get Attachment action in your loop and reference the Name in Dynamic Properties under Get Attachment you will have the full file name including the extension.

    image.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 245 Super User 2025 Season 2

#2
Expiscornovus Profile Picture

Expiscornovus 207 Most Valuable Professional

#3
trice602 Profile Picture

trice602 190 Super User 2025 Season 2

Last 30 days Overall leaderboard