Azure Logic App recipes: SharePoint/FTP connector- Monitor changes to a specific file
Scenario:
The SharePoint and FTP connectors provide a trigger to start the flow 'when a new file is created/modified'.
There may be scenarios where you would like to monitor the changes to a specific file instead of the whole directory.
Concept:
This can be achieved using a condition shape after the trigger.
The file name property of the trigger is a Base64 encoded value.
Hence we would need to decode this to string before using in the condition evaluation.
Example:
I have used the below SharePoint trigger and provided the site and folder details.
In the condition shape, I am using Base64ToString function to decode the Base 64 encoded file name from trigger.
Expression: base64ToString(triggerOutputs()['headers']['x-ms-file-name-encoded'])
Code snippet of condition shape:
"Condition": {
"actions": {},
"expression": {
"and": [
{
"equals": [
"@base64ToString(triggerOutputs()['headers']['x-ms-file-name-encoded'])",
"TestFileName"
]
}
]
},
"runAfter": {},
"type": "If"
}