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 / Remove record and imag...
Power Apps
Answered

Remove record and image location file at the same time

(0) ShareShare
ReportReport
Posted on by 997

Hello,

I was wondering if we can delete files

When we have data in the collection

I like to delete the record and also the image at the same time?

I use this code to remove them from the sharepoint list

 

If( CountRows(temp)>0,
ForAll(temp,
Remove(MyDataList,LookUp(temp, ID = ThisRecord.ID)));
 If(
 // check if there were any errors when the test score was submitted
 !IsEmpty(Errors(AuctionData)),
 // if true, show any error message
 Notify(
 Concat(Errors(MyDataList), Column&": "&Message),
 NotificationType.Error
 ),
 // else, go to success screen
 //Navigate('Success Screen');
 ForAll(temp,
 Remove(colAllData,LookUp(temp, ID = ThisRecord.ID)));
 If(
 // check if there were any errors when the test score was submitted
 !IsEmpty(Errors(colAllData)),
 // if true, show any error message
 Notify(
 Concat(Errors(colAllData), Column&": "&Message),
 NotificationType.Error
 ),
 Notify("Success",
 NotificationType.Success);
Clear(temp);
Back()

 )))

 

In the same MyDataList we have a column named URL

So that's where the image location of the folder has been added

How can i delete the image at the same time when using the above code?

The URL looks like this:

 

https://my.sharepoint.com/sites/folder/Shared%20documents/1.folder/06.folder/1.PHOTOS/201/bn-0008.jpg

 

The URL 1.PHOTOS/ this part location/.JPG change all the time depend where the image has been located 

Thank you

Categories:
  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Hi @TimmyBoy ,

    Firstly, you cannot delete the file using a URL in Power Apps - you need to link the Document Library as a Data Source in your App. One example would be to have a Gallery (filtered to pick up the photos/s linked to the item) and then simply on an icon in the gallery

    RemoveIf(
     LibraryName,
     ID = ThisItem.ID
    )

    The key issue here is that you need to have one or more fields in the Library identifying the list record it belongs to (not the other way around), I use a numeric field I call IDRef containing the ID of the "parent" List record.

    It would be possible in Power Automate sending the file path as below

    WarrenBelz_0-1673171615170.png

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • TimmyBoy Profile Picture
    997 on at

    Hello @WarrenBelz 

    Not sure, but guess i do something wrong here

    TimmyBoy_0-1673173870037.png

    TimmyBoy_1-1673174102723.png

     

     

  • TimmyBoy Profile Picture
    997 on at

    @WarrenBelz 

    Ok, seems i got it all wrong

    I have created a new Libary called 6.PHOTOS

    But still no idea how i can get the location i have in this Library 6.PHOTOS/301 or any other folder

    TimmyBoy_0-1673174755847.png

    Because i need this

     

    https://my.sharepoint.com/sites/6.PHOTOS/201/

     

    To get the file ID from the photo bn-0008.jpg

     

  • Verified answer
    WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    @TimmyBoy ,

    These are two completely separate and unrelated options (Power Apps and Flow). The point I was making in the Power Apps option is that your current structure simply will not do what you need - either you change completely what you are doing and put an identifier field (such as the ID of the list item I mentioned) in the Library for each record (a fair bit of work setting up including back-populating all existing records), or you try the Power Automate route and send the Library-level file name and path to the Flow. 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • TimmyBoy Profile Picture
    997 on at

    Thank you @WarrenBelz 

    I will look into it 😉 and see what's the best choices will be for me.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard