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 Automate / Attach multiple items ...
Power Automate
Answered

Attach multiple items to an email via forms

(0) ShareShare
ReportReport
Posted on by

I have followed this guide

 

Emailing File Attachments from Forms with Power Automate – What Me Pa..Panic? (dontpapanic.com)

 

However unfortunately it sends an email for each item uploaded, and each subsequent email also has the attachment for the previous email attached:

 

Email one: Attachment One

Email two: Attachment One and Two

Email three: Attachment One, Two and Three

 

and so on.

 

How can I prevent this please?

 

This is my schema if it's useful?

 

{
 
    "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"
        ]
    }
}
 
LukeSykes_0-1670583482217.png

 

Categories:
I have the same question (0)
  • LukeSykes Profile Picture
    on at

    @Pstork1 

     

    Hi Paul

     

    Please can you let me know how to collect the schema?

  • Pstork1 Profile Picture
    68,717 Most Valuable Professional on at

    Run it once with a schema of {}. Then take the output of the parse JSON in the run and use that to generate the schema usingthe built in button.

  • LukeSykes Profile Picture
    on at

    Excellent - thank you

  • LukeSykes Profile Picture
    on at

    Hi Again @Pstork1 

     

    For some reason, doing this sends multiple emails like mentioned in my original post, so if i attach 3 items it sends

     

    Email one: Attachment One

    Email two: Attachment One and Two

    Email three: Attachment One, Two and Three

  • Pstork1 Profile Picture
    68,717 Most Valuable Professional on at

    Move the Send an email action outside the loop that appends the documents to the array.  Having it inside the loop sends one email as each document is added. You have to add all the documents first and then send the email

  • LukeSykes Profile Picture
    on at

    PERFECT!!!

     

    Thank you so much

  • LukeSykes Profile Picture
    on at

    how can I make this still work if there is no attachment on the form? It fails at the Parse Json action

  • Pstork1 Profile Picture
    68,717 Most Valuable Professional on at

    If you give them the option to not upload a file then you need to check whether an attachment exists or not before doing the Parse JSON.  If it doesn't have any attachments skip the parse JSON and the loop and just send the email. The attachment array at that point will be empty.

  • LukeSykes Profile Picture
    on at

    Ok

     

    So I'm checking for that with a condition - problem is I want it to send the email either way.

     

    The form has a drop down where you select which staff list you want to send the email to, there are 7.

     

    Does that mean building 14 switches? 7 for if there is an attachment under 'If Yes' in the condition and 7 under 'If No' for if there isn't one?

  • Pstork1 Profile Picture
    68,717 Most Valuable Professional on at

    No, You check to see if the question where you upload a file is empty or not.  If its not empty you need to create the array. If it is empty then you skip creating the array (the parse json and loop actions). Then send the email normally.  You just add a condition to check for attachments and put the parse json and the loop inside the yes of that condition. Then send the email after the condition.  That has nothing to do with who you are sending the email to.

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 Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard