Mar 24 2022 04:47 AM
Mar 24 2022 04:47 AM
I'm struggeling with one of my Flows at the moment.
Background: I have a Library were about 20 documents (automatically created PDF's with some charts) are saved in 5 different folders and shared (Everyone with the link). Each month the documents are "replaced/overwritten" with an updated copy of the file. For the past months we did this manually. So the updated files (with the same name like the files in the Library) were copied with drag & drop in the browser and clicking on "replace". During this copy process, the original files were overwritten, and the share-link stayed the same. So our customers were able to access the new file, via the "old" share-link. (you can also see the versioning of the file creating a new version)
Now I was trying to automate this process with a Flow. As document source I was trying to work with my personal OneDrive and also with a library on the same SharePoint site. Creating the Flow wasn't a big deal, but the Flow did something I did not expect. Instead of replacing the file - like it does with drag&drop - the flow replaced the original file as version 1.0 and the before created share-link stopped working.
I tried several different copy-processes, here are some examples:
- SP:GetFileContent -> SP:CreateFile (in temp library) -> SP:MoveFile (to destination library and replace)
- SP:GetFileContent -> SP:CreateFile (in temp library) -> SP:CopyFile (to destination library and replace)
- OD:GetFileContent -> OD:CreateFile (in OD Subfolder) -> OD:CopyFileToURL (to destination library and replace)
- PowerShell commands to upload files to a library
- SP:HTTPRequest (getfilebyserverrelativeurl + replace)
But it was always the same result... the original file was replaced and seemed like a completely new file instead of "attaching it as a new version".
Does anyone know how to achieve this, or if it is possible? Or perhaps the is an alternative solution to update files (PDF) and keep their created share-link?
Thanks in advance
Mar 31 2022 08:04 AM
Apr 01 2022 09:24 AMSolution
Professionals might have to duty their profession ;)
You could simply use 'get content using path' if your locations are this static and then perform an 'update file' action providing the content of it on your target file.
This way a new version is created and any sharing link remains functional.
Given that you might need to stick on the 'create file' action instead ensure the option 'Allow chunking' below 'Content Transfer' within the actions´ settings is turned off.
In my case, both approaches simply created a new file version and have had no impact on the sharing link created beforehand.
Apr 04 2022 10:59 AM