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 / adding an attachemnt t...
Power Apps
Answered

adding an attachemnt to sharepoint list using patch

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm trying to add an attachment to sharepoint using Patch and the attachment control ?

Apparently there is a field called "Attachments"- built into a sharepoint List ?

 

Looking to see if this is Possible.

 

attach patch.jpg

Categories:
  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    Please read this articol:

    https://powerapps.microsoft.com/en-us/blog/add-attachments-to-sharepoint-lists/

     

    Upload and delete an attachment only work inside a form. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Yes, I read that piece,

    was hoping to find another way.

    I'm not using a form to collect the information.

     

    dave

  • rebeccas Profile Picture
    2,591 on at

    I use the attachments part a lot on sharepoint list and I like it but it is true that you cannot use patch for it. You will have to put in a form. You can either change what you have and place it in a form or if you don't want to do that you can have a form that only shows the attachment card (Title but have to be hidden) and then have the button submit the form and your patch can write over the fields you have being entered in (to basically modify those fields). 

     

    Your patch would go on the OnSuccess of the form and refer to the Form.LastSubmit to make sure it goes on the same item. If you decide to do that route let me know and I can help you out on it with some more details.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Rebeccas, Yes, That will work.

    Was just trying to figure out how to do it.

    Dave

  • rebeccas Profile Picture
    2,591 on at

    I typically put my stuff in a form BUT if you already did a lot of work on it and want to keep the patch option you can do this. 

     

    Keep what you have for your patch and add a form for the attachment. You will need to keep the title field (because it is required) and a card for the attachments. It will be a new form (not edit). You can unlock the title card and make the default "TEMP" and then hide that card so you don't see it. The button will just submit the form. 

     

    Then on the forms OnSuccess have:

     

    Set(varLastID, Form1.LastSumit.ID) ,-- this is what you will refer to for the patch to make sure your fields go on same line item

     

    and after that

     

    Patch(SharePointList, LookUp(SharePointList, ID=varLastID), {Patch data here with columns and fields})

     

    Another option I sometimes do is have a second sharepoint list for just the documents and a tie point between the two. Let me know if you like that idea better and I will tell you how you can do that. 🙂

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you very much first.

    Keep what you have for your patch and add a form for the attachment. You will need to keep the title field (because it is required) and a card for the attachments. It will be a new form (not edit). You can unlock the title card and make the default "TEMP" and then hide that card so you don't see it. The button will just submit the form. 

    If the form is in view mode only. How do you attach a file. Or did I misunderstand? or can u attach in view mode ?

    The button will just submit the form.  Do I use my current button? or do i add a new button to the attachment form ?

     

     

     

    Another option I sometimes do is have a second sharepoint list for just the documents and a tie point between the two. Let me know if you like that idea better and I will tell you how you can do that.

    I will take anything i can get at this point.

     
  • rebeccas Profile Picture
    2,591 on at

    The Form mode will be New.

     

    You can keep your button as you have it but instead of the button having the patch code on it that you have now you are moving that Patch part over to the OnSuccess of the form (with a variation to it because you are editing an item, not creating a new with your patch). And then the OnSelect of the of the button is going to be SubmitForm()

     

    So - 

    Click button -> SubmitForm -> ID from item created by the SubmitForm -> Patch the same item to change the details. 

     

    I did a video this week that is different than what you are doing but it uses the attachment content with documents you might check out (I don't contract out to do this work...I just do videos sometimes to share). 

     

    First video shows how it works (demo basically):

     

    https://youtu.be/IldjDHP-q-s

     

    Second shows how the data is set-up and how it works together:

     

    https://youtu.be/SNN-sdDhN3I

     

    Hope this helps! 🙂

    For mine I have several documents I attatch and they are each separate sharepoint list. Just to give you some ideas of different things you can do with it. I use the attachments control A LOT!

     

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Rebeccas, Yes, Was taking a sec to soak in.

    ok, very good , will give it a whirl.

    Thanks very very very much !!

     

    Dave

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I knew there had to be a way.

    Best thing I have seen since Buttered Bread !!

    I subscribed by the way on youtube. Great stuff.

     

    Dave

  • rebeccas Profile Picture
    2,591 on at

    Thanks! I just build apps for one company but I have built a TON that we use (probably over 60 active right now) and so just do some videos for the heck of it when I figure out how to do things I think others might find useful. 

     

    Also useful to me when I haven't done something in a while and can't remember how/why I did it like I did..lol!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard