Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Delete document also from Recycle bin with Power Automate

Posted on January 8, 2023January 8, 2023 by Tom

“Can I restrict users from restoring deleted files from the recycle bin, to delete them also from there within Power Automate flow?”


If you use SharePoint as a document management system, you get a lot of functionality out of the box. Files are versioned, there’s support for draft/published versions, and nothing is deleted permanently. And that’s great in many situations. But in some specific situations it’s not beneficial, more specifically if you delete files using a flow and users keep restoring them from the recycle bin.

How do you fully delete a file to avoid it?

Delete file from a recycle bin with an HTTP request

As Power Automate doesn’t have any action related to the SharePoint recycle bin, you must use a “workaround”. That means another HTTP requests, or two…

To delete a file from a recycle bin you need the file ID. Not the file name, not the identifier, but the unique id in the recycle bin. This id will be among the outputs of the HTTP request below…

Method:
GET

Uri:
_api/web/RecycleBin?$filter=LeafName eq '<fileNameWithExtension>'&$select=Id

…and you can access it directly with this expression:

body('Send_an_HTTP_request_to_SharePoint')?['d']?['results'][0]?['Id']

Once you have the id you can do the actual removal from the recycle bin.

Method:
DELETE

Uri:
_api/web/RecycleBin('<fileUniqueId>')
Power Automate delete recycle bin

That’s it, the file is completely gone.

Summary

Recycle bin is another part of SharePoint that doesn’t have a direct support from Power Automate, yet if you delete any file it’ll always end there. If you want to remove it also from the recycle bin, you’ll need two HTTP requests – one to get the file ID and another one to delete the file. Just be careful with the solution as it’s bypassing one of the safety SharePoint features. Once you delete the file it’ll be deleted completely.


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

2 thoughts on “Delete document also from Recycle bin with Power Automate”

  1. Benjamin says:
    February 11, 2025 at 1:44 pm

    Can this be wrapped in a for each to collect all the unique IDs of any files with a specific file type and then run the delete request for every file found in the recycle bin that has that file type?

    Reply
    1. Tom says:
      February 22, 2025 at 7:39 pm

      Hello Benjamin,
      yes, it can. In the example I’m selecting only the specific file using the index [0] as I’m expecting that it’ll return only one file since I’m searching by the full file name. But if you modify the filter to get multiple files, you can add a loop and delete all of them.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Still exchanging emails to get things approved?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy an automated, fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes