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 / Use PoweApp V2 to add ...
Power Apps
Unanswered

Use PoweApp V2 to add mutiple attachments from Power App into a SharePoint list item

(0) ShareShare
ReportReport
Posted on by 16

Hi everyone,

 

This is my first time building a Power App. Appreciate if anyone could help me, Thanks!

 

I wanted to let user able to upload multiple attachments, and these attachments will then be added to a SharePoint list item. I have used Power App V2 in Power Automate to do so, however, I've only managed to do so with one attachment. Below is my code and the flow:

 

Set(VarJSON,JSON(Image1.Image,JSONFormat.IncludeBinaryData));
Set(VarBase64,Mid(VarJSON,Find(",", VarJSON)+1,Len(VarJSON)-Find(",", VarJSON)-1));
ClearCollect(
    ArrayDoc,
    {
        ID:currentItem.ID,
        AttachmentName:Last(attachment.Attachments).Name,
        AttachmentBase64: VarBase64  
    }
);

 

Rev_Trac_SubmitDocs.Run(JSON(ArrayDoc),User().Email);

a1.png

a2.png

a3.png

 

What mistake I could have probably done wrong? The user able to upload multiple attachments in Power App, but SharePoint item can only capture one attachment. Please help me, thanks!

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,968 Super User 2026 Season 2 on at

    @Ivan29 

     

    Please provide the entire flow or at least we can see your Apply to Each. Also, please provide the entire schema and a sample for your JSON parse

     

    lastly, since you are allowed to add multiple attachments, you have not explained why it doesn't work. Do you get an error? Have you looked at a Run to validate that it tried to attach more than one?

     

    Please add more clarity and images as part of your answer.


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • ANB Profile Picture
    7,252 Super User 2026 Season 1 on at

    Hi @Ivan29 , I believe that you are using Shane Young's video here? Basically I can see the code is just capturing the information of only one last attachment in the collection. Just for the confirmation, your Image control property is also Last(attachmentcontrol.Attachments).Value ?

     

    So basically you need to have collection of all attachments and then use it accordingly in Power Automate. Please check Reza's video https://www.youtube.com/watch?v=r3UC3TMXhlI where he explain how to add multiple attachments.

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


  • ANB Profile Picture
    7,252 Super User 2026 Season 1 on at

    Hi @Ivan29 , Reza's video will help you to add multiple attachments as new items in SP list, however if you are looking to attach multiple attachments to single item in SP list, then below code will help you.

    This code will collect all attachment details:

     

    ClearCollect(
     col_allattachment,
     attachmentcontrolname.Attachments
    );

     

     The below code will help you create new collection with ID as new column:

     

    ForAll(col_allattachment As var, 
     ClearCollect(ArrayDoc, 
     {
     ID:currentItem.ID,
     AttachmentName:var.Name,
     AttachmentContent: var.Value 
     }
     )
    )

     

    Then below code will help you convert your ArrayDoc collection into JSON:

     

    Set(
     gblvar_JSON,
     JSON(
     ArrayDoc,
     JSONFormat.IgnoreUnsupportedTypes
     )
    );

     

    Now, in the Power Automate you will pass gblvar_JSON as input parameter.

    The Parse JSON action will remains same in your Power Automate, just make sure that in above code, I have changed column to AttachmentContent.

    Then in action where you are using Add Attachment, you do not have to use any conversion of base64ToBinary. You just need to use current item.

     

    items('Apply_to_each')['AttachmentName']
    
    items('Apply_to_each')['AttachmentContent']

     

    ANB_0-1698134310984.png

    You do not have to initialize any array variable. Just get the body of your output of Parse JSON action.

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


     

  • Ivan29 Profile Picture
    16 on at

    Yes, I was referring to his video and the image control property is Last(attachmentcontrol.Attachments).Value

  • Ivan29 Profile Picture
    16 on at

    Thanks for the reply and the solution, however, I have encountered this error while trying the code, saying that "this function cannot be invoked within ForAll". May I know how can I solve this error?

    a4.png

  • ANB Profile Picture
    7,252 Super User 2026 Season 1 on at

    Hi @Ivan29 , Can you confirm what is the currentItem? Is it a variable? And where you have written this code? 

     

    Thanks,

    ANB

  • Ivan29 Profile Picture
    16 on at

    Yes, it is a variable that I set where i have written it in the item property on an edit form to display the list item that the user has selected from a gallery to edit it

  • ANB Profile Picture
    7,252 Super User 2026 Season 1 on at

    @Ivan29 Use this

    ForAll(col_allattachment As var, 
     Collect(ArrayDoc, 
     {
     ID:currentItem.ID,
     AttachmentName:var.Name,
     AttachmentContent: var.Value 
     }
     )
    )

     

    And Once the Flow is triggered, then after that use 

    Clear(ArrayDoc)

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


     

  • Ivan29 Profile Picture
    16 on at

    Thanks for your help! Do you mean that after i triggered the flow, I would then add this code inside? or do i need to delete any code and then add this?

    Clear(ArrayDoc)

     

  • ANB Profile Picture
    7,252 Super User 2026 Season 1 on at

    Hi @Ivan29 , This is how it should look:

    ClearCollect(
     col_allattachment,
     attachment.Attachments
    );
    ForAll(col_allattachment As var, 
     Collect(ArrayDoc, 
     {
     ID:currentItem.ID,
     AttachmentName:var.Name,
     AttachmentContent: var.Value 
     }
     )
    );
    Set(
     gblvar_JSON,
     JSON(
     ArrayDoc,
     JSONFormat.IgnoreUnsupportedTypes
     )
    );
    Rev_Trac_SubmitDocs.Run(gblvar_JSON,User().Email);
    Clear(ArrayDoc)

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


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

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard