web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Flow to delete a file ...
Power Automate
Unanswered

Flow to delete a file in sharepoint library - delete by file name

(0) ShareShare
ReportReport
Posted on by 107

Hi Power Automate experts

 

I am trying to make a flow for deleting a file from sharepoint, through power app. In the app, I have the file name.
This is where I am right now.

Could anyone help me from here..

111.png

 

Thanks.

Categories:
I have the same question (0)
  • Verified answer
    fchopo Profile Picture
    8,003 Moderator on at

    Hi @SearchingYT 

    You could do something like this:

    delete_powerapps.png

     

    1) Get those files in SharePoint that have the filename specified in Power Apps, using an OData Filter Query.

    2) If an item is found: length(body('Get_Files_(properties_only)')?['value']) > 0

    2.1.) Get the first item, and read its ID to get the details: first(body('Get_Files_(properties_only)')?['value'])?['ID']

    2.2) Delete the file through the File Identifier property.

    The most important thing to understand is that the "Get Files" could return more than 1 item, although it's supposed not to have repeated files with the same filename. Then, we get the first element (first function), avoiding the use of an "apply-to-each".

     

    Hope it helps!

    Ferran

  • Baltner Profile Picture
    149 on at

    Greetings: I'm trying to do the same thing but what I haven't got quite right yet is the OnSelect formula in a PowerApps button to trigger this flow. For a context variable filename in the app I tried:

    DeleteFileFlow.Run(filename)

    but I get a syntax error telling me that Run expects two parameters and I've only provided one.  Some articles I've found suggest that I have to add a filter query but in this case the first() function does all the filtering I need.  So how do I call this flow from the app?

     

    Thanks!

  • Baltner Profile Picture
    149 on at

    OK, I finally figured out that the number of input parameters has to equal the number of places in the workflow that you specifically apply "Ask in PowerApps " to define an input. Pretty obvious once you see it but I'm still learning!

    Any way thanks for the good article about deleting files by name.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard