cancel
Showing results for 
Search instead for 
Did you mean: 

Delete attachment through function (click on a button)

Hello,

 

Through SharePoint List we are able to attach files to it, however we are too limited regarding its manipulation based on fucntions. For example (https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/Function-to-remove-attachments-on-Sh...) we are not able to delete an attachment through a function (we are able to do it just in the Attachments control).

 

Thank you in advance.

Regards,

Pedro Pereira

Status: New
Comments
jnash1578
Regular Visitor

I'm not sure if my situation is exactly what you're referring to. I have a scenario in which my users are filling out a form on a mobile app. Rather than simply viewing the attachment descriptions, I wanted my users to be able to view the images in a gallery. I created a new screen with a gallery where items are set to DataCardValue55.Attachments which is a table of the attachments from my form. In the gallery, I tried to put a delete button. I tried to have the delete button run a Remove function OnSelect but it doesn't like DataCardValue55.Attachements as the collection because it's actually a table. Here's what I tried first:

Remove(DataCardValue55.Attachments,ThisItem)             Issue: DataCardValue55.Attachments is a table

I could turn DataCardValue55.Attachements into a collection named "files" as follows:

ClearCollect(files,DataCardValue55.Attachments)

Then I could delete items as follows:

Remove(files,ThisItem)

but then I'm just removing files from a collection named "files", and when I return to the form, all of the attachments are still there. I couldn't figure our how to replace them with the "files" collection.

Remember that this form has not been submitted, and I would like for my user to view and delete image attachments in one place. Any suggestions would be greatly appreciated. Thanks, jnash1578