In this example I want to be emailed ANY time a file called Technical.txt is modified in a folder called Documents/Backup
First I will create an automated flow with the following trigger:
- When a file is created or modified in a folder
Specify the SharePoint site and in my example I will be monitoring /Documents/Backups for any changes to Technical.txt
Create a compose action so you can test and verify you get a true result when comparing the dynamic content of x-ms-file-name-encoded to Technical.txt
This may take some trial and error but look at the run history till you get a true result on the compose action
equals(base64ToString(triggerOutputs()?['headers/x-ms-file-name-encoded']), 'Technical.txt')
When testing the above expression in a compose action the result was true so I will use that expression to set a conditional trigger on the main trigger so this flow will ONLY run if the file specified is created/modified
Now that I know my expression is correct I can add it to the conditional trigger section on the main trigger by clicking the ellipses (…) and click Settings
Near the bottom click Add and put an @ symbol in front of your expression code and paste it in like so:
@equals(base64ToString(triggerOutputs()?['headers/x-ms-file-name-encoded']), 'Technical.txt')
Now create a Send an email action and in the subject I wanted to say what file was edited so I used this expression:
base64ToString(triggerOutputs()?['headers/x-ms-file-name-encoded'])/* Your code... */
I then added some text in Technical.txt and saved the file from my synced library on my machine and got this email (sweet a free sandwich):