Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
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,411 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,285 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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

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

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 97

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 70 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard
Loading started