Skip to main content

Notifications

Community site session details

Community site session details

Session Id : C+nfodBUCEcaqSTEwisdYw
Power Automate - Building Flows
Suggested answer

Keeping a file's extension when creating it from "Get File Content"

Like (0) ShareShare
ReportReport
Posted on 8 Nov 2024 23:31:34 by 4
Hi,

My flow starts with a Form through which users can provide attachments.
 
These attachments are automatically saved to a OneDrive folder, and my flow copy these on different Sharepoint folders through "Get File Content" [OneDrive] and "Create File" [SharePoint]. I use this opportunity to rename the file according to a specific nomenclature.
 
Does anyone know how to preserve the Extension of the original file?
 
Please keep in mind my level is that of a beginner.
 
Thanks!
  • creativeopinion Profile Picture
    10,419 Super User 2025 Season 1 on 09 Nov 2024 at 20:38:56
    Keeping a file's extension when creating it from "Get File Content"
    You might be interested in this YT Tutorial: How to Add Microsoft Form File Uploads to a SharePoint List Item
     
    Although this specific tutorial covers how to add a MS Form file upload to a SP list item, the concepts covered in this tutorial can be applied to your flow. If you get suck—upload screenshots of your flow in the Classic Designer (toggle off the New Designer) with all actions expanded (in Edit Mode).

    In this Microsoft Power Automate Tutorial I’m going to cover how to add file uploads to a SharePoint list item. First, I’ll show you how to get the file name and content from the File Uploads from your Microsoft Form, then I’ll show you how to add those files to a SharePoint item. 

    IN THIS VIDEO:
    âś“ Two types of MS Forms
    âś“ Where Microsoft Personal (OneDrive) Form File Uploads are Saved
    âś“ Where Microsoft Group Form File Uploads are Saved
    âś“ How to Add a File Upload Question to an MS Form
    âś“ How to get a Microsoft Form ID
    âś“ How to get a Microsoft Form Response
    âś“ How to Get the Dynamic Content Microsoft Form File Upload Content
    âś“ How to handle Single and Multiple Microsoft Form File Uploads
    âś“ How to use a Scope action to Organize and Group Your Flow Actions
    âś“ How to Get the File Content from an MS Form File Upload
    âś“ How to Collect All Files from Multiple File Upload Questions
    ✓ How to Handle MS Form Response When a File Isn’t Uploaded
    âś“ How to Attach an MS Form Single File Upload to a SharePoint List Item
    âś“ How to Attach Multiple MS Form File Uploads to a SharePoint List Item
    âś“ How to Attach MS Form File Uploads to an Email
     

     
    Hope this helps!

    Consider giving me a ❤️ if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram
  • Suggested answer
    CFernandes Profile Picture
    8,295 Most Valuable Professional on 09 Nov 2024 at 16:23:19
    Keeping a file's extension when creating it from "Get File Content"
    Hey Mate, Just use the expression below
     
    In Compose, this will give you the file extension - split(item()['name'],'.')[1]
     
     
     
    Full Solution - 

     
    Output
     
     
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
     
    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.
     
  • CU08111613-0 Profile Picture
    14 on 09 Nov 2024 at 15:38:15
    Keeping a file's extension when creating it from "Get File Content"
    Use this flow layout to preserve the file extension when renaming:

    Trigger: When a new response is submitted (Forms).

    Action: Get attachments.

    Action: Get file content (OneDrive).

    Compose: Extract the original file name.

    Compose: Extract file extension using split() and last()
    last(split(outputs('Compose_FileName'), '.'))

    Compose: Create the new filename by appending the extension
    concat('YourNewFileName_', utcNow(), '.', outputs('Compose_FileExtension'))

    Action: Create the file (SharePoint) with the new filename.

    This layout will keep the original file extension while applying a new name.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard >

Loading started
Loading complete