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 attachments from...
Power Apps
Unanswered

Patch attachments from collection to Sharepoint list

(0) ShareShare
ReportReport
Posted on by 6

Hi everyone

 

I have an app to take photos of inspections and I needed to have the offline feature in case the user loses reception. For that reason, I'm populating a collection with photo and description, then patching into the Sharepoint list once the connection is restored.

 

Everything works fine but the attachment.. I've looked up in many forums and apparently the only way to do this is through PowerAutomate. However, I'm beginner in both tools and I couldn't understand the explanations that I found. Could someone help please?

 

More details about the app:

- The collection columns are the same as the SP list

- The attachment control can have multiple attachments

- I'm using 2 forms and 2 galleries. One for offline, connected to my collection, and the other online, connected to my SP list.

Categories:
I have the same question (0)
  • Manan-Malhotra Profile Picture
    621 Super User 2024 Season 1 on at

    This below image code is basically patching the attachment in a collection, which can be later patched to a table

    Hope this is something that can help you

    To create a attachment column in a collection what i did was, I used a table and collected its column which also had a attachment column, then Cleared my collection to just use that column, this was done through dataverse table

    MananMalhotra_0-1668415859676.png

     

  • Macshihiro Profile Picture
    6 on at

    Hi @Manan-Malhotra 

    Thank you for your answer!

    I'm currently using the attachment column that came straight from Sharepoint. Would there be any difference if I create one in the collection instead?  Below is the current state of my collection. I have an item with two attachments

     

    Macshihiro_0-1668472161924.png

    Macshihiro_1-1668472173650.png

    This is what I'm using to patch some data in the collection

    Macshihiro_2-1668472586105.png

    and this is what I'm using to move the data from the collection to the SP list.

    Macshihiro_5-1668473020263.png

    Unfortunately, I receive this error

    Macshihiro_6-1668473088750.png

    Could you just confirm if your code would fix this error? Sorry for my ignorance =(

  • Manan-Malhotra Profile Picture
    621 Super User 2024 Season 1 on at

    If I am not wrong seems like you were able to patch the data successfully in the collection, however the error is during patchin sharepoint
    Try using    First(Attachments....)

    However this will patch only the first one, so I recommend using a unique identifier number to patch the correct attachment 

  • Macshihiro Profile Picture
    6 on at

    Hi @Manan-Malhotra

    I need to patch multiple the attachments. So, in every item in the collection, I need to upload all the attachments.

    I did this manually, but the list should look like this after patching to SP, or at least this is what I'm trying to do:

    Macshihiro_0-1668502017942.png

     

    Just had an idea here. What if I do a PATCH to Sharepoint using First(Attachments) to upload the first attachment, then delete the first attachment, and repeat it until all the attachments are uploaded. I don't know if that's possible or feasible.

  • Manan-Malhotra Profile Picture
    621 Super User 2024 Season 1 on at

    Please try using a ForAll instead of First then, where you need to provide the correct unique identifier to patch the attachments related to your single record from the collection.
    I know a forall is used before patch aswell, however you will be using this 2nd forall for attachment column.
    Let me know if this works for you!

  • Macshihiro Profile Picture
    6 on at

    Thanks for your patience Manan. I tried with another ForAll but no success. In one of my tests, I noticed that the attachment field has curly brackets { } when I do Collect(PhotoCol, PhotoApp). Anyways, it didn't work either =,(

    Macshihiro_0-1668664595316.png

  • Yerlasdutco Profile Picture
    118 on at

    @Macshihiro 

     

    Hi, did you resolve it? I faced the same issue

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

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard