Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Adding a file by code to an attachments control

(0) ShareShare
ReportReport
Posted on by 75

Hi everyone.

I have an approval app that allows user to add one or more files to a SP list. It works very well using a datacard and an attachments control.

I was ask to modify the app in order to start from another list, retreive the document on that other list and add it to the approval List via the app (and the attachments control).

So basically, what I want to do is to add a file to an attachments.

 

I'm able to launch my app from the second list. And I retreive the file (filename, full name and complete path) . I saved it in a collection. Now, how can I add it to the control ? With a Patch ? what's the default value then ?

Any help would be great ! Thank you

 

 

 

 

 

 

  • fsim Profile Picture
    75 on at
    Re: Adding a file by code to an attachments control

    @timl 

    absolutely ok with that !

    thank you

     

  • timl Profile Picture
    34,933 Super User 2025 Season 1 on at
    Re: Adding a file by code to an attachments control

    @fsim - Would I be correct in thinking that so long as you can copy the contents of a SharePoint attachments field from one record in one list to a new record in another list, that would satisfy your requirement?

    You wouldn't be too concerned if you don't use a collection? The reason I ask is because I believe this is possible, but not the exact way that you envisage. So I just want to clarify this before I describe this in more detail.

  • Vijay Tailor Profile Picture
    2,961 on at
    Re: Adding a file by code to an attachments control

    Hi @fsim ,

    I don't think so this is also possible.
    I agree with  @timl, as part of the attachment - some limitations here.

    if you need a solution for the future regarding the same, please you can vote for the below Idea.
    https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Allow-to-Patch-File-in-SharePoint-using-AbsoluteURI/idi-p/714351
    if you think that will useful for others also.
    Thanks,

    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."-Vijay





  • fsim Profile Picture
    75 on at
    Re: Adding a file by code to an attachments control

    @VijayTailor  Thank you for your answer. 

    My attachment control is inside a form that said. Note that I wanted to patch the table behind the attachment control, not the Sharepoint list directly. In fact it's impossible that way, as the approval record don"t exist yet.

     

     

  • fsim Profile Picture
    75 on at
    Re: Adding a file by code to an attachments control

    @timl , yes it's not an append it's just adding one file  automatically (file that is retreived by a sharepoint collection at the start of the app)

     

  • timl Profile Picture
    34,933 Super User 2025 Season 1 on at
    Re: Adding a file by code to an attachments control

    Hi @fsim 

    As you've probably figured out, file support in PowerApps is a bit limited.

    To help develop some sort of workaround for you, are you looking to always add the files to a new record in your approval list (as opposed to appending files to an existing record in your approval list)?

  • Vijay Tailor Profile Picture
    2,961 on at
    Re: Adding a file by code to an attachments control

    Hi @fsim ,

    I think that is not possible yet, Now through Code.

    See the below response - (Taken from one of the Post suggested by Microsoft Team members.)

    See the limitation of attachment control:

    Upload and delete functionality only work inside a form. Attachment control will look disabled when in Edit mode and not inside a form. Note that in order to save the file additions and deletions to the back end, the end user must save the form.

    https://docs.microsoft.com/en-us/powerapps/controls/control-attachments

     

    It seems that so far you cannot use Patch to upload the attachments to SharePoint. Please consider to add comments in below thread:

    https://powerusers.microsoft.com/t5/PowerApps-Ideas/Save-attachments-to-SharePoint-list-item/idi-p/8...


    Source - of Above mentioned Comment - https://powerusers.microsoft.com/t5/Building-Power-Apps/Patch-Attachments/td-p/98121


    Thanks

    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."-Vijay

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,596 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,928 Most Valuable Professional

Leaderboard