cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AIPedersen
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.

 

Solution:

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.

1 ACCEPTED SOLUTION

Accepted Solutions

Part 1/2Part 1/2

 

Part 2/2Part 2/2

 

 

View solution in original post

2 REPLIES 2
AIPedersen
New Member

Capture.PNG

 

 

Part 1/2Part 1/2

 

Part 2/2Part 2/2

 

 

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.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (7,021)