Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Closeout Package Form - Append Multiple Attachments to Sharepoint List

(1) ShareShare
ReportReport
Posted on by 39

I am working on a flow where an installer can upload a single PDF in MS Forms and then in a separate question they can upload to 10 images. The flow below will add the PDF and the first install image but not the remaining nine. What am I missing? All of the images get uploaded to the Sharepoint folder but only one attachment from each question is being added to the list in Sharepoint

 

ScottAD_0-1713990133860.png

 

  • trice602 Profile Picture
    13,792 Super User 2025 Season 1 on at
    Re: Closeout Package Form - Append Multiple Attachments to Sharepoint List

    Hi @ScottAD ,

     

    Nice to see this working!

     

     

  • ScottAD Profile Picture
    39 on at
    Re: Closeout Package Form - Append Multiple Attachments to Sharepoint List

    That did it!

  • Verified answer
    trice602 Profile Picture
    13,792 Super User 2025 Season 1 on at
    Re: Closeout Package Form - Append Multiple Attachments to Sharepoint List

    Hi @ScottAD ,

     

    No worries, I don't think you are being obtuse.  The root cause is you are using the dynamic content expression first() in the file name so you are getting the first file.

     

    Because you are in a for each loop, you want to use the dynamic content for "name" from the parse JSON action in both your get file content using path "File Path" AND the add attachment "File Name" fields.

     

    Your dynamic content for these two should be:  items('Apply_to_each_2')['name']

     

    Goes without saying, don't type it in, select the dynamic content "name" from your parse JSON action.

     

    trice602_0-1713994222508.png

     

  • ScottAD Profile Picture
    39 on at
    Re: Closeout Package Form - Append Multiple Attachments to Sharepoint List

    Thanks for your patience as I learn this, and apologies if I come across obtuse. I'm still not getting the result I expect. I still only get one file from each question. Here is a detail of the flow.

     

    Condensed

    ScottAD_0-1713992875526.png

    Don't need anything for new response or get, those work

    Create item

    ScottAD_1-1713992919824.png

    Initialize Variable - Not sure if needed

    ScottAD_2-1713992943710.png

    Apply to Each 1 - Not needed if Variable isn't

    ScottAD_3-1713992972393.png

    Parse JSON for PDF

    ScottAD_4-1713993014976.png

    Schema for Parse JSON PDF

     

     

    {
     "type": "array",
     "items": {
     "type": "object",
     "properties": {
     "name": {
     "type": "string"
     },
     "link": {
     "type": "string"
     },
     "id": {
     "type": "string"
     },
     "type": {},
     "size": {
     "type": "integer"
     },
     "referenceId": {
     "type": "string"
     },
     "driveId": {
     "type": "string"
     },
     "status": {
     "type": "integer"
     },
     "uploadSessionUrl": {}
     },
     "required": [
     "name",
     "link",
     "id",
     "type",
     "size",
     "referenceId",
     "driveId",
     "status",
     "uploadSessionUrl"
     ]
     }
    }

     

     

    Get file using content path

    ScottAD_5-1713993071697.png

    Expression for Get file - first(body('Parse_JSON_COP_PDF'))?['name']

     

    Add attachment - Expression is same in Get file content

    ScottAD_6-1713993126322.png

    Condition

    ScottAD_7-1713993175374.png

     

    Expression - 

    empty(outputs('Get_response_details')?['body/rc0f5347cf1c045d7b67f0d23981070ed'])
     
    If Yes
    ScottAD_8-1713993237063.png

     

    Schema for Parse JSON Install Images

     

     

    {
     "type": "array",
     "items": {
     "type": "object",
     "properties": {
     "name": {
     "type": "string"
     },
     "link": {
     "type": "string"
     },
     "id": {
     "type": "string"
     },
     "type": {},
     "size": {
     "type": "integer"
     },
     "referenceId": {
     "type": "string"
     },
     "driveId": {
     "type": "string"
     },
     "status": {
     "type": "integer"
     },
     "uploadSessionUrl": {}
     },
     "required": [
     "name",
     "link",
     "id",
     "type",
     "size",
     "referenceId",
     "driveId",
     "status",
     "uploadSessionUrl"
     ]
     }
    }

     

     

     

    Apply to each 2

    ScottAD_9-1713993294683.png

     

     

    ScottAD_10-1713993313310.png

     

    Expression - first(body('Parse_JSON_INSTALL_IMAGES'))?['name']

     

    ScottAD_11-1713993352591.png 

     

  • trice602 Profile Picture
    13,792 Super User 2025 Season 1 on at
    Re: Closeout Package Form - Append Multiple Attachments to Sharepoint List

    Hi @ScottAD ,

     

    Sorry I added a 2nd post after the fact.  It is the body of the parse JSON action for your images.

     

     

  • ScottAD Profile Picture
    39 on at
    Re: Closeout Package Form - Append Multiple Attachments to Sharepoint List

    Thanks I understood where I need put things but do I even need the variable in this? Here is the new flow

     

    ScottAD_0-1713992261991.pngScottAD_1-1713992284218.png

     

  • trice602 Profile Picture
    13,792 Super User 2025 Season 1 on at
    Re: Closeout Package Form - Append Multiple Attachments to Sharepoint List

    Hi @ScottAD ,

     

    If you are manually adding the apply to each or for each loop, the content is body from Parse JSON action but I typically just add the next step and let the loop create item to ensure the right dynamic content is selected.

     

     

  • trice602 Profile Picture
    13,792 Super User 2025 Season 1 on at
    Re: Closeout Package Form - Append Multiple Attachments to Sharepoint List

    Hi @ScottAD ,

     

    If you are going to use the conditional action to see if any uploads exists (because the question may be optional), send then after parse json, you will add the action "Get file content using path".

     

    You will point to the site address where the files are uploaded, typically something like:

     

    https://abc-my.sharepoint.com/personal/thomas123

     

    The file Path is in this format and starts with a "/"

     

    /Documents/Apps/Microsoft Forms/[Your sheet name]/[Your question name]/[dynamic content_body name]

     

    (don't include the square brackets above, illustrated to show these are dynamic content.  This is the folder where the attachments from a form are stored.

     

    Next in Add attachment you have your site address (of the list) and the list name followed by 3 variables:

     

    ID (is the ID of the list)

    File name (is the bodyname dynamic content from parse json)

    File content (body from get file content)

     

     

  • ScottAD Profile Picture
    39 on at
    Re: Closeout Package Form - Append Multiple Attachments to Sharepoint List

    Thank you, in Apply to each, what should I be using there?

  • trice602 Profile Picture
    13,792 Super User 2025 Season 1 on at
    Re: Closeout Package Form - Append Multiple Attachments to Sharepoint List

    Hi @ScottAD ,

     

    The issue with the second upload question is it needs to be in a loop so for each file, get content, add the attachment.  This one seems to work well, here's an example:

     

    First, I have the entire 2nd question code in a condition (in case it is empty), you don't want the error but if true, parse the json question, and then apply to each, get file attachment content using path, add attachment.

     

    The condition statement is empty(dynamic_content_for_2nd_question) is not equal to expression true.

     

    trice602_0-1713990950265.png

     

     

     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1