cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
skarthanal
Helper II
Helper II

change file extension with power automate

Is it possible to change an existing file's extension in a SP document library?  I have seen many example on renaming the file's name but not the actual extension.  For example is a file's name is file.html can i change it to file.aspx without having to create a new file and deleting the old one?  Thanks!

6 REPLIES 6
GeorgiosG
Solution Specialist
Solution Specialist

Hi @skarthanal ,

 

I am not aware of an action for simply changing the file type with one action in Power Automate. you can Create a new file with the content and just pass in file name the new format with a concat() function. You can use directly Name with .xlsx like in my screenshot or use an expression 

concat(FileName,‘.docx‘)


CCCD9200-4071-4A16-9A61-029A03430BBD.jpeg

A57EBFB1-51CC-4BEA-91CB-68210F8093AE.jpeg

Happy to help.
If I have answered your question, please mark your post as Solved.

Thank you your response, I was aware of this but i was looking to retain the document id and not have to create a new one and delete the old file.

GeorgiosG
Solution Specialist
Solution Specialist

Maybe you can use the SharePoint API with the Send HTTP Request to SharePoint action.

maybe you can go with that approach 

 

B4248E03-8B91-4408-ADF5-533A87846290.jpeg

Happy to help.
If I have answered your question, please mark your post as Solved.

I tried this and got the flow to work however, it is not working as we expect.  If the file already stored in the library is <FileName.aspx> and i want to change it to <NewFile.txt> the flow will run successfully but it only changes the file's name not the extension.  I end up getting NewFile.html

GeorgiosG
Solution Specialist
Solution Specialist

Are you also passing in the extensions ? 

I made a quick research and also found that it Wald solved with another api endpoint, maybe that helps https://powerusers.microsoft.com/t5/General-Power-Automate/Renaming-SharePoint-file-using-REST-API-w...

Happy to help.
If I have answered your question, please mark your post as Solved.

Yes i am passing the filename and extension within the body liek below.  I even tried the new endpoint and it doesnt not change the actual extension.

 

 

{
"formValues":[
{
"FieldName":"FileLeafRef",
"FieldValue":"Filename.txt"
}
]
}

skarthanal_0-1650638384048.png

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (2,541)