Showing results for 
Search instead for 
Did you mean: 
New Member

Rename file in sharepoint with Expressions

It has taken me a good deal of browsing and meddling to get this flow to work. My main hurdles was:

  1. It is cumberhensome to change the name of the file in SP with flow
  2. Present methods did not allow the use of expressions in the renaming in SP.



move the file from SP to OD, rename it in OD, move it back to SP  and delete any traces. This loop takes a template and produces a weekly report every friday. I hope it can help others or at least inspire to a more simple flow.


Flow programme: 


  1. SP-Get File Metadata  --> SP-Get File content --> OD-Create file
    This section identifies the file in question in Sharepoint, takes the content and create a copy of the file in One Drive

  2. OD-Get File Metadata --> OD-Get file content --> OD-copy file
    This section identifies the file when its located in OneDrive, holds the content and rename it in the copy process. By renaming it in OneDrive it is possible to use expressions in the naming of the file. 
    For example for printing week number I have used the expression: div(add(dayOfYear(utcNow()), 7), 7).

  3. SP-Create file --> SP-Create Sharing link for a file or folder ---> OD-Delete file
    Create the file based on the name and content from section 2.
    Also creates a link to the renamed file to be used in an email
    Finally it deletes the file that was created on OneDrive as it only served to rename the originial file.

NB. It is eesential to use dynamic content in all the steps in this flow. 

Disclaimer: The programme is messy and cumberhensome, I have used a lot of effort to get here since Flow is still limited with SP tools. And to be frank I am tired of this programme by now, Flow should have been able to do this simple operation much easier.


Accepted Solutions

Part 1/2Part 1/2


Part 2/2Part 2/2



View solution in original post

New Member




Part 1/2Part 1/2


Part 2/2Part 2/2



Great solution!

Helpful resources

Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (16,236)