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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to remove sharepoi...
Power Apps
Answered

How to remove sharepoint file when x clicked on upload file

(0) ShareShare
ReportReport
Posted on by 302

el5_0-1710774143800.png

I have this code that uploads the file into the sharepoint library on add file. but when the file is removed from the upload, it doesn't remove from the list. What code would I use to achieve this?

 

Categories:
I have the same question (0)
  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @el5 

    You may try to call the flow on the Attachment control -OnRemoveFile property:

    vyueyunmsft_0-1710813690652.png

     

    Best Regards,

    Yueyun Zhang

     

  • el5 Profile Picture
    302 on at
    TestFlow.Run({file:{contentBytes:Last(Self.Attachments).Value,name:Last(Self.Attachments).Name}})
    How would I write it? Exactly like this again?
  • Verified answer
    v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @el5 

    Thanks for your quick response! We can use this code to get the delete file name on the Attachment control - OnRemoveFile.

     

    Attachment - OnAddFile:

    ClearCollect(attches , Self.Attachments);

    Attachment - OnRemoveFile:

    ClearCollect(removecol , Self.Attachments); ForAll(removecol ,  RemoveIf(attches As t1, t1.Value  = Value && t1.Name = Name));

     

    For example , if we upload three files:

    1.png , 2.png , 3,png    

    And then we delete the 2.png , we can get the 2.png file name from  attches collection.

    vyueyunmsft_0-1710896391047.jpeg

     

    Then we can pass this file Name to a new flow. Then we can use the flow to find the file in your sharepoint and then delete it in your flow. And you need to create a new flow to delete the file in my understand.

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard