Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Delete image from both a collection and SP attachment



I'm using a form, MyForm, from which a user can take pics that will be saved as attachments.


For that i've set up a Camera that, upon clicking on it, will "save" - Collect() - the picture(s) in a collection named Collection1.

I've put a gallery, Gallery1, which is displaying the images from that Collection1.

In that gallery there's a trash icon which appear on each pictures, with OnSelect set to


RemoveIf(Collection1;DisplayName= ThisItem.DisplayName)


In that form, i've got a hidden attachments card and its update set to Collection1, in order to save all the pictures from Collection1 to the attachments column in the SPlist.


If this is the first time i take pics (no saved attachments yet that is), the trash icon delete the chosen images and upon hitting the form save button - SubmitForm(MyForm) - all the remaining images are saved as attachments in SP.




After all that i'd like to be able to delete some or all images when i go into EditForm(MyForm).


The trash button on each images still delete that image in Collection1 but that doesn't delete the attachment when hitting the SubmitForm(MyForm) button.

The cross button of the image in the attachment field does nothing as well when i hit the SubmitForm(MyForm) button.


I tried to set the OnSelect of the trash button as 

RemoveIf(Collection1;DisplayName= ThisItem.DisplayName);; Remove(MySPlist; Lookup(MySPlist; ID = ThisItem.DisplayName))

but it doesn't like the Lookup(MySPlist; ID = ThisItem.DisplayName) part.




How will i be able to delete an image from both the collection and attachments ?


Community Support
Community Support

Hi @dunnno ,


Do you want to remove attachments from the Sharepoint list in Power Apps?

Here are some links that might help you:


Best Regards,

Charlie Choi



The problem here is that the Attachments datacard is populated by the images in the collection, then the update of the datacard send those images to the attachments of the SP list item.

That means that i never see in my form the actual attached files.


I can delete an / or all images from the collection but it won't remove it / or them from the SP list item attachments storage.

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,769)