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 Apps / Renaming files in Shar...
Power Apps
Unanswered

Renaming files in SharePoint using the name of a file already existing in the library

(0) ShareShare
ReportReport
Posted on by 362

The process I'm trying to build is:

 

1. upload a file to a SharePoint library

2. rename the new file using the name of an existing file, so the old file is kept as a version.

 

SharePoint just won't rename the new file, since the name is used for an existing file. 

 

Is there a setting in SharePoint I need to change to allow files to be renamed with the name of an existing file, or is there a way to do it using PowerApps and Power Automate? 

 

I know that I could simply rename the new file and THEN upload it to SharePoint, but it won't work with the solution I am trying to build.

 

Thanks to whomever can help! 

Categories:
I have the same question (0)
  • subsguts Profile Picture
    1,259 Moderator on at

    I found the following command at the link below.  So not my idea, but it appears this will solve you problem?

    subsguts_0-1666027868150.png

    Power Automate Rename File - EnjoySharePoint

     

     

  • Pstork1 Profile Picture
    69,577 Most Valuable Professional on at

    You can't rename a new file to be the same as an existing filename.  Even if you could it would overwrite the existing file, not save it as a new version.  This blog shows you how it can be accomplished.

    How to update (not replace) an existing file in Power Automate (tomriha.com)

  • Gilmour Profile Picture
    362 on at

    Hi @Pstork1, thank you for taking the time.

     

    I am getting the following error:

     

    Missing or mismatched field definition on the destination list for source field '_ExtendedDescription' type 'Note'. Source site template id 'GroupWebTemplateID', target site template id 'GroupWebTemplateID'. Total blocked root objects in this operation is [1].
    clientRequestId: etc...

     

    The only thing I've done differently is using a source and destination libraries in the same site. Does the solution require that the libraries are actually in two different sites? Below are screenshots of my flow.

     

    The first action of the flow (PowerApps) provides the file path and name for the two files using inputs OldFilePathname and NewFilePathName. The flow output for the actions seems to be correct.

    Gilmour_2-1666053771577.png

     

     

    Thank you for helping!

    Gilmour_3-1666057034201.png

     

     

    Gilmour_1-1666053294509.png

     

     

  • Gilmour Profile Picture
    362 on at

    Hi @subsguts. I’m going to give the solution suggested by PStork1 a try, as it seems simpler. Thank you for taking the time!

  • Pstork1 Profile Picture
    69,577 Most Valuable Professional on at

    Take another look at the article.  Its supposed to fail.  Then you set the run after setting on the get file properties to run only if the previous action fails.  Based on your screenshot you didn't do that.

  • Gilmour Profile Picture
    362 on at

    I tried to rebuild the flow per screenshots below, but now I am getting a new error message:

     

    Missing or mismatched field definition on the destination list for source field '_ExtendedDescription' type 'Note'. Source site template id 'GroupWebTemplateID', target site template id 'GroupWebTemplateID'. Total blocked root objects in this operation is [1].

     

    What am I doing wrong?

     

    Thank you for your help!

     

    Gilmour_3-1666089048021.pngGilmour_4-1666089543022.png

    Gilmour_5-1666089628911.png

    Gilmour_6-1666089687693.png

     

     

     

     

     

  • Pstork1 Profile Picture
    69,577 Most Valuable Professional on at

    The library you are copying the file to seems to have an additional metadata field of type 'Note' in it.  That seems to have been set as a required field and needs to be updated when the file is copied.  I'm not sure how you would do that using this method.  I think that the existence of that field is going to keep you from being able to add a file as a new version.

  • Gilmour Profile Picture
    362 on at

    Nope, no trace of such field.

    Except for (file) Name, the library has no required fields (all the metadata is provisioned via PowerApps).

    Could it be a field once existing and then removed? I doubt it, but it's the only other thing I can try. If so, I wouldn't know where to look for "ghost" fields...

    What a headache!

  • Pstork1 Profile Picture
    69,577 Most Valuable Professional on at

    Not sure what else to suggest.  It could be a field that was later deleted.  You might try just creating two new document libraries and see if you can get the concept to work.

  • subsguts Profile Picture
    1,259 Moderator on at

    Considering your struggles, I would think knowing more about why the following is not possible would be useful:

     

    "I know that I could simply rename the new file and THEN upload it to SharePoint, but it won't work with the solution I am trying to build."

    I only mention it because often when I'm trying to force a solution that I have in my mind maybe there is a different method to reach the same objective.  From an outsider's perspective it seems like you are going out of your way to create a version of a document, which is functionality SharePoint already provides if you simply upload a new version.  So, I'm just wondering why this is a requirement is all.  

    Maybe if that requirement is known to myself and others can get you to what you need without this complexity.  Just a suggestion...

     

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 366 Most Valuable Professional

#2
11manish Profile Picture

11manish 184

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 99 Super User 2026 Season 1

Last 30 days Overall leaderboard