cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Creating a static URL to a file name from Library

Hello,

 

I have a flow that when ever a file is modified or created it duplicates those changes on a Library which has matching files. However when ever a file is modified on the list, it will delete the file from the Library and then create a new copy back onto the library.

 

My problem is that the files from the Library I have the URL from them on our team site page and each time a file is modified on the List and it deletes and re-creates the file on the Library, it breaks the URL. 

 

Is there anyway around this to ensure that the same URL will always redirect to the file from the Library? All the files in the Library maintain the same name, as well as a unique ItemID(which is pulled from the list). So technically the properties don't change when its deleted and re created, but the URL does change.

 

Im open to other suggestions.

 

Capture10.PNG

 

 

3 REPLIES 3
Super User II
Super User II

Hey @kpiana 

I haven't replicated this in Flow to 100% validate but... if you delete a document and then upload another document with the same name this would change the item ID.

Rather than deleting the file and adding a new file... could you make use the of the SharePoint 'Update File' action? That should resolve your issue

HTH

Jay

-------------------------------------------------------------------------

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

If you like my response, please give it a Thumbs Up.

 

Highlighted

@Jay-Encodian 

 

That would be great if I could make it update instead of delete and replace the file. I haven't been able to figure it out but I attached a preview of the part of the flow that performs this current action. Maybe you can advice me what to change in order to make it update the file. 

 

So the Flow goes through a condition in which if it detects that the file already exists in the Library it then deletes it from the Library and then copies and paste the file from the List to that Library. The other route of the condition if it detects that it is a new file and it doesn't exist in the Library then it just jumps to the second step of coping and pasting.

 

Thank you Jay!

 

Capture11.PNG

                                                                                                                                 (Continued Below)

Capture12.PNG

Highlighted

Hey @kpiana 

I think you just need to incorporate the following approach... in short, try to update the file and if it fails then create the file.

To do this create a branch after the 'Update File' action... in one side of the branch add the 'Create' file action and set the run after properties so that is is only executed if the 'Update File' action fails.

1.png

 

If the file exists then the 'Update file' action works:

 

2.png

 

If the file doesn't exist then the 'Update file' action fails and then the 'Create File' executes.

3.png

This should have you covered 🙂

HTH

Jay

-------------------------------------------------------------------------

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

If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (12,893)