web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Remove or Overwrite at...
Power Apps
Unanswered

Remove or Overwrite attachments within a Collection

(0) ShareShare
ReportReport
Posted on by 49
Hello Power Apps Community,
 
I have a Power Apps form connected to a SPO list that contains attachment control.
 
The display name of the attachment needs to be renamed based on the selection made by the user on a dropdown list so I´m working with a collection in order to accomplish this.
 
The issue I am facing that once I submit the form with the attachment, then if I open this item in edit mode & remove the previous attachment and upload another one with the same name and submitting, the old/previous attachment is the one that remains not the new one.
 
I need to either be able to remove the attachment with the X or overwritte the attached document when another one with the same display name is uploaded and the form is submitted. This is the collection I´m using on the OnAddFile Property of the attachment control:
 
Set(varExtension,Find(".",Last(attachCedula.Attachments).Name));
Set(varExtension2,Mid(Last(attachCedula.Attachments).Name,varExtension));
ClearCollect(
    colCedulaAttachs,
    attachCedula.Attachments
);
 
UpdateIf(
    colCedulaAttachs,
    !StartsWith (DisplayName,DataCardValueCed_Exp.Text),
    {
        Name: DataCardValueCed_Exp.Text & "-" & DataCardValue_CodReq.Text & varExtension2,
        DisplayName: DataCardValueCed_Exp.Text & "-" & DataCardValue_CodReq.Text & varExtension2
    }
);
RemoveIf(
    colExpedienteAttachments,
    DataCardValueCed_Exp.Text in DisplayName
);
Collect(
    colCedulaAttachs,
    colExpedienteAttachments
   
   
);
 
As you can see it is not removing the files. I´ve tried adding another collection called "colExpedienteAttachments" but to no avail. 
 
On the OnRemovefile and OnUndoRemoveFile I´ve got "false".
 
Please help.
Thanks.
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    152,853 Most Valuable Professional on at
    Hi @AlexBS​​​​​​​
    The fundamental issue here is that the only way in Power Apps (excluding Power Automate) of adding the actual file content is with the attachment control itself. You can do all the file name manipulation as you are presently, but if you have a look in the collection, the Value field is a BLOB (Binary Large Object) reference that can only be changed/added by the control.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
  • AlexBS Profile Picture
    49 on at
    Anyone with a suggestion on this please

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard