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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

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.

I have the same question (0)
  • Verified answer
    fchopo Profile Picture
    8,001 Moderator on at
    Re: Flow to delete a file in sharepoint library - delete by file name

    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
    Re: Flow to delete a file in sharepoint library - delete by file name

    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
    Re: Flow to delete a file in sharepoint library - delete by file name

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 614 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 401 Moderator

#3
chiaraalina Profile Picture

chiaraalina 282

Last 30 days Overall leaderboard