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 Automate / Remove or Overwrite at...
Power Automate
Unanswered

Remove or Overwrite attachments within a Collection with a Flow

(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".
 
I need to be able to replace files either directly from power apps or using a Flow that removes the previous attachment with the new one with the same name.
 
I´ve already reached the Power Apps forums but somebody said this was not possible from within Power Apps.
 
Please help.
Thanks.
Categories:
I have the same question (0)
  • SaiRT14 Profile Picture
    1,990 Super User 2025 Season 2 on at
    Hi , 
     
    Since Power Apps has limitations in directly managing SharePoint attachments, you can use Power Automate to handle the attachment removal and replacement logic.
  • AlexBS Profile Picture
    49 on at
    Thanks SaiRT14 
     
    Any idea where to start doing so?

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 Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 463 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 427 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard