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

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.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,109)