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

Announcements

News and Announcements icon
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)
  • ScottShearer Profile Picture
    25,290 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

  • 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?

  • 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 VK. What you subjected works for me too... But I need to have the attachments rename with the email's subject line. 

     

    Thank you!

     

  • 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')

     

     

  • 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.



  • 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.

  • mmx9000 Profile Picture
    12 on at

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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard