cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dana_L
Regular Visitor

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

Hey everyone, 

I've been struggling with how to delete a file in a SharePoint folder when the same file is deleted in a different SharePoint site folder. I am VERY new to using Power Automate but I was able to successfully create my flow with some help from a programmer that I work with. Since I've seen several posts with the same or similar issues, I wanted to share what worked for us. Screenshots of my flow are below.

Dana_L_0-1627564519883.png

The function used for the my file identifier was coded as:

encodeUriComponent(concat('/Shared Documents/General/Meeting Agendas and Action Items/', triggerOutputs()?['body/FilenameWithExtension']))

 

Granted this flow might not work for you in your situation but hopefully,  you'll find it helpful.

All the best!

Dana_L

4 REPLIES 4
manuelstgomes
Super User
Super User

HI @Dana_L 

 

I would do the following:

1. Find the file first and get it's details. You can use the "Get file metadata using path" action to do it. Here you'll get the File Identifier that you can use in the next section.

2. Delete it using its ID. You can use the "delete file" action that you have. What you're including in the file ID is not the file ID and it's never good to try to generate it yourself.

 

Cheers
Manuel

------------------------------------------------------------------
If I have answered your question, please mark it as "Accept as Solution." It will help other members finding the solution faster. If you like my response, please give it a Thumbs Up. ?
Otherwise, reply to it, and the community will do its best to help you.

Hi @manuelstgomes ,

Thanks for your response. I tried the 'Get metadata using path' action as well as 'Send an HTTP request to SharePoint' and neither worked (NotFound). The post I made was to share what worked for me in case it helps others. 

Dana_L

manuelstgomes
Super User
Super User

Hi @Dana_L 

 

Sounds good..

 

Cheers
Manuel

------------------------------------------------------------------
If I have answered your question, please mark it as "Accept as Solution." It will help other members finding the solution faster. If you like my response, please give it a Thumbs Up. ?
Otherwise, reply to it, and the community will do its best to help you.

Powerplatform01
Post Patron
Post Patron

@Dana_L 

You can take reference from this Video. Also its my humble request to please subscribe this channel

 

https://youtu.be/639qnKw85n8

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,838)