'check if file exist on Sharepoint Online by File Name with Power Automate
I am trying to create a flow in Power Automate Cloud that allows me to extract some files from Google Drive and copy them to a Sharepoint folder. But before copying it, it has to check by the file name, that the file does not already exist in the sharepoint folder. I have managed to do the whole flow, except the checking. I would be very grateful for your help. Thank you very much. Best regards.
Solution 1:[1]
A File exists
action doesn't currently exist but you can use the Get file metadata using path
action from the SharePoint
connector to do the same sort of thing.
This flow below shows you an example of what you can do ...
For demonstration purposes, I've created an array with a list of file names (full path required) that I will then test the existence for.
One of those files doesn't exist.
I then loop through each one of those and try and get the metadata for each file.
If the resulting statusCode
from the call to get the metadata is not equal to 200, then we know the file doesn't exist.
Examples ...
To make this work however, you need to make sure that the Condition
step will execute after the metadata call no matter what the result.
Do this by making sure the Configure run after
settings are correct ...
So after all of that, all you need to do is deal with the true and false sections of the condition.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |