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

Community site session details

Session Id :
Power Apps - Building 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
    151,875 Most Valuable Professional on at
    Remove or Overwrite attachments within a Collection
    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
    Remove or Overwrite attachments within a Collection
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 766 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 419 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 235

Last 30 days Overall leaderboard