Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 7A7exl3b12giZ0upQGe+Sp
Power Automate - Building Flows
Answered

Create a file with Power Automate Flow but loses the extension file name

Like (2) ShareShare
ReportReport
Posted on 5 Jul 2024 14:56:39 by

Hello my friends, how are you?

 

Thanks again. You already helped me once and now I need one last bit of help to finish my work.

 

With the help of a friend here, I finished a flow within Power Automate that talks to Microsoft Lists and Microsoft Sharepoint.

Now, I've reached the final part, where the flow takes the contents of the attachment (or attachments) that the user includes when they create a new item. And the flow creates a new file in a specific folder in a specific Sharepoint library.

 

The creation is working perfectly!

But the file extension is lost when it creates the new file.

 

For example: If the user attaches a file called ASDFGHJKL.pdf and I want the stream to rename it to

FRIEND.pdf

the flow renames only to

FRIEND

without the extension (.pdf) at the end of the file

 

If the user attaches a file in PDF or PNG or JPEG or whatever, it renames the file correctly but loses the extension.

Can you help me?

1 (1).png

 

 

  • Verified answer
    fabtodton40 Profile Picture
    on 09 Jul 2024 at 14:59:57
    Re: Create a file with Power Automate Flow but loses the extension file name

    Thank you for the patience guys.

    I got it with this expression

     

    last(split(item()?['DisplayName'], '.'))
  • trice602 Profile Picture
    13,760 Super User 2025 Season 1 on 05 Jul 2024 at 17:18:59
    Re: Create a file with Power Automate Flow but loses the extension file name

    @Pstork1 ,

     

    Agreed but most posts here want to append at the end of the file name, not the front so this was something I built a while back and works in testing but not sure if there is a more efficient way to do it.  

     

     

  • Pstork1 Profile Picture
    65,997 Most Valuable Professional on 05 Jul 2024 at 16:47:18
    Re: Create a file with Power Automate Flow but loses the extension file name

    You would need to supply a '.' in front of the Atype or include it when creating the variable.  But you should be able to just use outputs('Get_Attachment_(V2)')?['body/name'] for the filename and have it include the extension.  You can still add additional information to the front of the new name.

  • trice602 Profile Picture
    13,760 Super User 2025 Season 1 on 05 Jul 2024 at 15:07:38
    Re: Create a file with Power Automate Flow but loses the extension file name

    Hi @fabtodton40 ,

     

    I found a flow I had that does this.  I create a new variable and then in this set I am setting the variable using this expression split()

     

    trice602_0-1720191944509.png

     

    split(outputs('Get_Attachment_(V2)')?['body/name'], '.')[0]
     
    trice602_2-1720192143405.png

     

     
    slice(outputs('Get_Attachment_(V2)')?['body/name'], indexOf(outputs('Get_Attachment_(V2)')?['body/name'], '.'))
     
     
     
    trice602_1-1720192046825.png

     

     

     
  • Pstork1 Profile Picture
    65,997 Most Valuable Professional on 05 Jul 2024 at 15:04:23
    Re: Create a file with Power Automate Flow but loses the extension file name

    There should be a dynamic content field that includes the extension. Simply use that instead of Data Vencimento. I'm not sure what it would be called, but if you look at a recent run you should be able to see it in the output of the SharePoint action.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard
Loading started