Skip to main content

Notifications

Deleting attachments from sharepoint list item

 Profile Picture Posted by Community member

Hello everyone,

 

  • Background: I have been working on a PowerApp where there is a gallery, and on select of a button in the gallery I am opening a Form in Edit mode that corresponds to a SharePoint list item. I am leveraging this form's attachment control to save pictures taken from Camera control. 
    dunkenshado_0-1708761421255.pngdunkenshado_1-1708761533636.pngdunkenshado_3-1708762564058.png

     

     

  • Issue: Deleting an Item does not actually deletes the item from the attachment rather creates duplicate of all other images except the one being deleted. I know if I make the attachments control visible then a user will be able to delete it directly from the control, but I want to achieve this using my delete button (through pfx).
  • Code:
    • OnSelect of Camera Icon:

 

ClearCollect(colAttachments,ThisItem.Attachments)

 

  • OnSelect of Save Button:

 

Collect(
 colAttachments,
 {
 DisplayName: "CaptureImage - " & GUID() & ".jpg",
 Id: "CaptureImage - " & GUID() & ".jpg",
 Value: Camera1.Photo,
 RowID: ThisItem.ID
 }
);
Reset(DataCardValue29);

SubmitForm(Form3);

Set(
 varSpinner,
 false
);
Refresh('Inspection Questions')​

 

  • OnSelect of Trash Icon:

 

RemoveIf(colAttachments,Id=ThisItem.Id);Select(Icon5)​

 

  • OnSelect of Icon5:

 

Reset(DataCardValue29);SubmitForm(Form3);​

 

Categories:

Comments