Moving files with Power Apps/Automate

Copper Contributor

Hello users,

 

I need for my Sharepoint to create in Power App a way so a file it's moved automaticaly when a new is added.

 

To be more explicit:

 

1. I have a folder for Document. I add a new file with name "X" through Power Apps in that folder.

2. After some time I want to upload a new file (same name "X", new revision) through Power Apps, in the same folder, but I want that old "X" to be moved automaticaly in an "Archive" folder.

 

I managed to implement the upload, getting folder path etc, but I can't figure it out how I can tell the Power App which file to automaticaly select and move when a new one is added.

The process of adding and re-adding a new file is not at the same time.

 

Can anyone help me, at least telling me if it's possible to select in Power App a file that's already uploaded?

 

Thank You!

6 Replies

Hi @Rares1055 

 

You can use Scope in Power Automate to validate if filename already exists in library.

Don't know how you are managing the upload, but if you are using a flow which I assume, you would start with a condition, checking for the filename by doing a get files action and utilizing the Odata filter then you can check the count of the returned items array. If it's not empty then you can move that file somewhere else, then proceede with your create file action.

@Chris Webb 

 

That's my flow. Where is "Move file" should move the old file and after that creat the new one.

 

Can you help please?

I don't really know how to do that. Can you elaborate please?

@Rares1055 does that flow not work? Assume you don't have the run after set on Create? You can click Create File action ... and Configure Run after, and check the boxes so it runs even if it fails (no file to move). But not sure if that's your only issue here is when files don't exist it fails and won't create? 

Hello, I kinda succeded with this plan, keeping the same file but using revision. Now another problem is that is creating 2 rev. at same time (one creating the file and one updating it with details in columns). Is it possible to avoid the revision when the file is created? I'm interested only on the file with new details.