Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Delete image from both a collection and SP attachment

(0) ShareShare
ReportReport
Posted on by

Hi,

 

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.

 

QUESTION :

 

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

 

  • dunnno Profile Picture
    dunnno on at
    Re: Delete image from both a collection and SP attachment

    Hi,

     

    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.

  • Re: Delete image from both a collection and SP attachment

    Hi @dunnno ,

     

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

    Here are some links that might help you:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Delete-a-specific-attachment-in-a-sharepoint-list/td-p/489787

    https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-delete-attachment-in-sharepoint-item/m-p/1267633

     

    Best Regards,

    Charlie Choi

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,434

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,722

Leaderboard