Dear Experts ,
I have an issue while deleting power app attachment. please see below and help
Issue:
When attempting to delete a file from the attachment control in a Power App integrated with SharePoint, the deleted file reappears after saving the form.
Collection: colattachments
SharePoint List: 'India Contract Approval List'
Attachmentdatacard: DataCardValue28
App Initialization: OnStart:
ClearCollect(
colattachments,
Defaults('India Contract Approval List').Attachments
);
Refresh(Defaults('India Contract Approval List').Attachments);
SharePoint Integration: OnEdit and OnView:
If(
CountRows(colattachments) = 0,
SharePointIntegration.Selected.Attachments,
colattachments
);
Screen Visibility: OnVisible property:
Refresh('India Contract Approval List');
Refresh(Defaults('India Contract Approval List').Attachments);
ClearCollect(colattachments, DataCardValue28.Attachments);
Attachment Update Property:
DataCardValue28.Attachments
On Add File (this File tagging with reference with @RezaDorrani)
ClearCollect(
colattachments,
DataCardValue28.Attachments
);
UpdateIf(
colattachments,
!(First(Split(DisplayName, "-")).Value in colattachmentTags),
{
Name: drpAttchtag.Selected.Value & "-" & Name,
DisplayName: drpAttchtag.Selected.Value & "-" & DisplayName
}
);
OnRemove Property:
ClearCollect(colattachments, ThisItem.Attachments)
Attachment Item property - this has referred from @WarrenBelz's advice
If(CountRows(colattachments)=0, ThisItem.Attachments,colattachments)
OnSave Action:
ClearCollect(colattachments, DataCardValue28.Attachments);
SubmitForm(SharePointForm1);
How to Modify the setup to ensure that deleted files are permanently removed from the attachment control and do not reappear after saving the form.

Report
All responses (
Answers (