Jan 05 2023 11:06 PM
Jan 05 2023 11:06 PM
I would like to know if it is possible with PowerAutomate to auto-move an older to document from a folder(to another) when a new one is added?
It would help our company to keep in that folder only the most actual version.
Jan 06 2023 07:13 AM - edited Jan 06 2023 07:23 AM
@Rares1055 Do you mean when a new version of the same file is added? Or do you mean when any file is added to a folder, move out any older files?
If you're just looking to move any older files, that's fairly easy. Use the item created Sharepoint trigger, then get the list of files in the folder and check the datestamps against the newly created item, moving anything older.
If you're talking about older versions of the same item, that's a bit more difficult, but perhaps the following 2 blog posts might provide some insights.
Jan 08 2023 10:23 PM - edited Jan 08 2023 10:26 PM
First of all, thank you for your reply!
I have different ideas of what to do, but I don't know how.
First it would be to add a different file (different revision) and to have a column with choice VALID/INVALID. When a new file is added, that one becomes VALID and all others INVALID.
Second, I add a new file and the other revision that is already in the folder to move somewhere in another Library.
Do you have any idea for the first one? It seems to be pretty nice if we can pull it through.
Jan 12 2023 01:00 AM
Sure, you can build a flow that does exactly that... it would look like this
Trigger: [SharePoint] When a file is created in a folder
Action: [SharePoint] Get Files (Properties Only)
Filter Query: ID ne <ID from the Trigger> and Status eq "VALID"
Apply to Each Result from "Get Files"
Action: [SharePoint] Update File Properties
Action: [SharePoint] Copy File
Destination Folder: Your Archive Folder
But i would not go through all that hassle.
Just enable versioning on that document library and always save the file as the same filename.
If you want to see older versions of the file, just take a look at the document history of that file.