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 / CHANGE FILE EXTENSION ...
Power Automate
Unanswered

CHANGE FILE EXTENSION WHEN ITEM IS CREATED IN SHAREPOINT

(0) ShareShare
ReportReport
Posted on by

Dear Sir,

 

Any help how could i change the file extension when I upload and file in sharepoint (believe When item is created)?

 

for example .sat to .txt

 

Thanks

Categories:
  • Rhiassuring Profile Picture
    8,692 Moderator on at

    Hi, 

     

    Not really - you need to create the new file with the extension you want, you could then delete the old file.


    Your trigger would be - you are correct - "when an item is created". Then you'd do this:

     

    Rhiassuring_0-1673725046963.png

     

    (I stole this screenshot from this post where @GeorgiosG  was detailing how to do this)

     

    You'd just finish this up with a "Delete File" and select the one that came in via trigger.

  • PRABA7385 Profile Picture
    on at

    Hello,

     

    I followed, my files actually uploaded in Library, I'm unable to see library site:

     

    PRABA7385_0-1673784630368.png

     

  • PRABA7385 Profile Picture
    on at

    @Rhiassuring 

     

    Do you please able to help on this?

     

    I followed, my files actually uploaded in Library, I'm unable to see library site:

     

    PRABA7385_0-1673970543597.png

     

     

  • Rhiassuring Profile Picture
    8,692 Moderator on at

    Sorry for the confusion - you want "When a file is created". Item is for if you are using a list. Files go in libraries, items go in lists.

  • SamLed Profile Picture
    2,340 Moderator on at

    Hi @PRABA7385,

     

    There is an advanced solution to rename a file including extension using REST API call. This offer many benefits:

    • One only call, no need to create a new file and delete old one
    • Creator and creation datetime can be preserved
    • File keep same ID

    Here a sample flow design to illustrate how to make it working:

     

    SamLed_1-1708046056077.png

    • I use "Get file" properties to get "Link to item" which is the absolute URL to the file we'll need in the API request body.

     

    SamLed_2-1708046220675.png

    • CurrentFileUrl expression: decodeUriComponent(first(split(outputs('Get_file_properties')?['body/{Link}'], '?')))

    I split "Link to item"by '?' and take first item from resulting array. That way I've got the file absolute URL free of any URL parameters.

    • NewFileUrl expression: replace(outputs('CurrentFileUrl'), outputs('CurrentExtension'), outputs('NewExtension'))

    Here I made it simple for the example, stored the old and new extension then replace in the URL, but you can use the replacement method that best suits your needs.

     

    SamLed_3-1708046799646.png

    • Here I build the request body with:
      • srcPath: outputs('CurrentFileUrl')
      • destPath: outputs('NewFileUrl')
    • Note the available options:
      • KeepBoth: Move file when false, copy file when true
      • ResetAuthorAndCreatedOnCopy: Preserve source file creator/creation date when false, reset when true

     

    SamLed_5-1708047629370.png

    • Method: POST
    • Uri: _api/SP.MoveCopyUtil.MoveFileByPath()
    • Headers:
    Accept application/json;odata=verbose
    Content-Type application/json;odata=verbose
    • Body: outputs('HTTPRequestBody')

     

    Results:

    SamLed_6-1708048313126.png

    SamLed_7-1708048400379.png

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 426

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard