cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Flow how to trigger when a file is modified

I am creating a flow to create/update the file in Azure file storage when the file is created or modified in sharepoint.

 

I have created a flow to create a file in File storage When a new file is added or modified in SharePoint.

 

It works fine when create a new file.

 

However, When modify/updatea file, the flow failed because of error "conflict". Apprantly, it can't overwrite the exsiting file in file stroage using create.

 

I think I need to buit a flow for modfied file to update existing file, but How to do built the condition to differ create and modified file?

 

Appreciate any suggestion?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Anonymous,

 

Do you want to update the existing file within Azure File Storage when same file is modified in your SharePoint library?

 

You could consider take a try to create flow, add a Condition to check if the file has been existed in Azure File Storage within it. If the file has been existed, update the existing file. If not, create a new file in Azure File Storage.

 

I have made a test on my side and  please take a try with the following workaround:

  • Add a "When a file is created or modified in a folder" trigger.
  • Add a "List files" action of Azure File Storage connector, specify Folder.
  • Add a Variables-> "Initialize variable" action, Name set to FileNameArray, Type set to Array and Value set to empty.
  • Add a "Apply to each" action, input parameter set to output of "List files" action.
  • Within "Apply to each" action, add a "Append to array variable" action, Name choose FileNameArray and Value set to Name dynamic content of "List files" action.
  • Under "Apply to each" action, add a "Condition", left input box set to FileNameArray variable, right input box set to File name dynamic content of the trigger. Within middle drop down, choose contains.
  • Within "If/yes" branch of "Condition", add a "List files 2" action, specify Folder. Add a "Filter array" action, From set to output of "List files 2" action, within Condition box of "Filter array", left input box set to Name dynamic content of "List files 2" action, right input box set to File name dynamic content of the trigger, within middle drop down, choose is equal to.

         Add a "Apply to each 2" action, input parameter set to output of "List files 2" action, within "Apply to each 2" action, add a "Update file" action, File field set to Id dynamic content of "Filter array" action, File content field set to File Content dynamic content of the trigger.

 

  • Within "If/no" branch of Condition, add a "Create file" action, specify Folder path, File name field set to File name dynamic content of the trigger, File content field set to File Content dynamic content of the trigger.

 

Image reference:14.jpg

 

12.JPG

 

13.JPG

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xida-msft
Community Support
Community Support

Hi @Anonymous,

 

Do you want to update the existing file within Azure File Storage when same file is modified in your SharePoint library?

 

You could consider take a try to create flow, add a Condition to check if the file has been existed in Azure File Storage within it. If the file has been existed, update the existing file. If not, create a new file in Azure File Storage.

 

I have made a test on my side and  please take a try with the following workaround:

  • Add a "When a file is created or modified in a folder" trigger.
  • Add a "List files" action of Azure File Storage connector, specify Folder.
  • Add a Variables-> "Initialize variable" action, Name set to FileNameArray, Type set to Array and Value set to empty.
  • Add a "Apply to each" action, input parameter set to output of "List files" action.
  • Within "Apply to each" action, add a "Append to array variable" action, Name choose FileNameArray and Value set to Name dynamic content of "List files" action.
  • Under "Apply to each" action, add a "Condition", left input box set to FileNameArray variable, right input box set to File name dynamic content of the trigger. Within middle drop down, choose contains.
  • Within "If/yes" branch of "Condition", add a "List files 2" action, specify Folder. Add a "Filter array" action, From set to output of "List files 2" action, within Condition box of "Filter array", left input box set to Name dynamic content of "List files 2" action, right input box set to File name dynamic content of the trigger, within middle drop down, choose is equal to.

         Add a "Apply to each 2" action, input parameter set to output of "List files 2" action, within "Apply to each 2" action, add a "Update file" action, File field set to Id dynamic content of "Filter array" action, File content field set to File Content dynamic content of the trigger.

 

  • Within "If/no" branch of Condition, add a "Create file" action, specify Folder path, File name field set to File name dynamic content of the trigger, File content field set to File Content dynamic content of the trigger.

 

Image reference:14.jpg

 

12.JPG

 

13.JPG

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

I wish it would be a template for:

notify when a file is modified on a Team to all team members. 

 

You see - we have a file that it is important to know when when a filen is updated. 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Users online (3,478)