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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch and replace atta...
Power Apps
Answered

Patch and replace attachment in existing Sharepoint list item

(0) ShareShare
ReportReport
Posted on by 443

I feel like I keep hitting a brick wall with this...I am currently building a request app where a user can upload an attachment.  The request is returned to the user, they have an option to upload another file.  I only want one attachment per request.  How do I overwrite the inital attachment with a new attachment the user is providing?

Categories:
I have the same question (0)
  • Verified answer
    v-yuxima-msft Profile Picture
    Microsoft Employee on at

    Hi @lumberjacklurch,

     

    Could you please share a bit more about “replace the old attachment with the new one” that you mentioned?

    Do you want to delete the old attachment from the SP list item, instead, add the new one?

    I afraid that there is no way to achieve your needs in PowerApps currently.

     

    As an alternative solution, you could consider take a try to only show  the newest attachment in your app, please take a try with the following workaround:

    You can change the DetailForm’s Attachments’  DataCard.Deafult and EditForm’s Attachments’ DataCard.Default to Last(ThisItem.Attachments)

     

    I test as this:

    Attachments_DataCard2.Default: Last(ThisItem.Attachments)

    Attachment_DataCard1.Default: Last(ThisItem.Attachments)

    20190131patchreplaceattachment1.jpg

    20190131patchreplaceattachment2.jpg

     

    Result Test:

    20190131replaceattachmenttest.gif

     

    Hope this can be helpful.

    Best Regards.

    Yumia

     

  • Verified answer
    lumberjacklurch Profile Picture
    443 on at

    Yumia,

    Thank you for the reply.  I did get it working...kind of.  What I was trying to do was replace the attachment via patch, and, you're right, it will not work that way.  So, I had to do it in a form.  Once I utilized the attachments control in a form, I upped the max allowed files from 1 to 2.  After populating the form with the selected item's data, the user can see (and then delete) the old file attachment and, at the same time, upload a new file attachment to replace it.  After that, I just used SubmitForm() to save the changes to the item.

  • amoncayo Profile Picture
    36 on at

    I used:

     

    Patch(source, Default(Source), {Record}, FormName.Updates) 

    and it worked great!!

  • PytByt Profile Picture
    943 on at

    @amoncayo wrote:

    I used:

     

    Patch(source, Default(Source), {Record}, FormName.Updates) 

    and it worked great!!


    Hi @amoncayo  and @v-yuxima-msft 

    I also need to add new attachment to the same record in the same SP List. 

    I use submitform and it keeping creating new record in the same SP List. What i need is the new attachment is adding to the same record, so i can have many attachment in the same record field in my SP List items.

     

    is it possible?

     

    thanks,

    pytbyt




  • amoncayo Profile Picture
    36 on at

    I know there is a 10mb max for attachments, you may have to use Collect and create a gallery. 

  • PytByt Profile Picture
    943 on at

    @amoncayo wrote:

    I know there is a 10mb max for attachments, you may have to use Collect and create a gallery. 


    @amoncayo 

    i thought that the size can we customize? no?

  • amoncayo Profile Picture
    36 on at

    A control that allows users to download files to their device, as well as upload and delete files from a SharePoint list or a Common Data Service entity.

    Limitations

    The attachment control has these limitations:

    1. Attachments are supported with SharePoint lists and Common Data Service entities.

    2. Upload and delete functionality work only inside a form. The Attachment control appears disabled when in Edit mode and not inside a form. To save file additions and deletions, the app user must save the form. Because of this limitation, the Attachment control isn't available from the Insert tab but appears in the form when the Attachment form field is enabled in a SharePoint or Common Data Service form.

    3. You can upload files only if they're 10 MB or smaller.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard