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

When a file is deleted in a SharePoint folder, delete file with the same name in a different folder

Greetings all,

 

Is there a way for me to use the "When a file is deleted" trigger to delete a file by the same name in a different location? 

 

The use case is this: 

 

I have a folder on a SharePoint site that holds Excel templates. I already have a flow in place that will duplicate any files placed in that folder to several other children locations (different sites) in their corresponding template folders. What I'd like to do is have automation that does the following: when a file is deleted from the parent template folder, it will also be deleted from all of the children folders such that all of the children remain mirrors of the parent. 

 

The flow works great for copying new files and overwriting changed files to the child folders, but I'm not sure how to setup the deletion of those files when they get deleted from the parent. 

 

Thanks in advance!

6 REPLIES 6

HI @Anonymous,

 

Yes, you could build a flow that looks a bit like this:

 

 

DeleteFile.PNG

Anonymous
Not applicable


 

@Pieter_Veenstra wrote:

HI @Anonymous,

 

Yes, you could build a flow that looks a bit like this:

 

 

DeleteFile.PNG


Thank you for the response! I tried that exact setup but unfortunately it always fails with the following error: 

 

{
  "error": {
    "code"404,
    "source""flow-apim-msmanaged-na-westus2-01.azure-apim.net",
    "clientRequestId""f128fc37-a7f2-48fc-924d-ec6c1be7ed51",
    "message""The response is not in a JSON format.",
    "innerError""The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
  }
}

Hi @Anonymous,

 

 You could add an action-Get file metadata using path to the Flow, get the File Identifier first, and then delete the file.

Image reference:

28.PNG

 

Best Regards,

Barry

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

Can you please explain what would be the file path?

Could you please elaborate on this?

Hi Anonymous and others that might have this same issue. Check the post where I shared what worked for me. Hopefully, it will help. 

SOLVED: When a file is deleted in a SharePoint fol... - Power Platform Community (microsoft.com)

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!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,860)