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 / Adding a file by code ...
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

 

 

 

 

 

 

Categories:
I have the same question (0)
  • Vijay Tailor Profile Picture
    2,961 on at

    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

  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    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)?

  • fsim Profile Picture
    75 on at

    @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)

     

  • fsim Profile Picture
    75 on at

    @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.

     

     

  • Vijay Tailor Profile Picture
    2,961 on at

    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





  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    @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.

  • fsim Profile Picture
    75 on at

    @timl 

    absolutely ok with that !

    thank you

     

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard