Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 4/Wv7nHI1CZQFRfpHgi8q9
Power Automate - Building Flows
Answered

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

Like (0) ShareShare
ReportReport
Posted on 19 Apr 2021 13:04:16 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.

  • Baltner Profile Picture
    147 on 13 Feb 2023 at 15:44:18
    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.

  • Baltner Profile Picture
    147 on 13 Feb 2023 at 06:50:13
    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!

  • Verified answer
    fchopo Profile Picture
    7,968 Super User 2025 Season 1 on 19 Apr 2021 at 13:51:29
    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

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started