cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Sending an email with form attachment

So I have been building a few flows recently with good success but I have got stuck getting this last bit to work. To date I have got it working so that when a ms form response is submitted I can send an email with a link to the uploaded attachment using PARSE JSON with this code:

 

{
    "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"
        ]
    }
}

And then inserting the link in the body emails and teams message with this expression: 

first(body('Parse_JSON'))?['link']
 
This all works well, but what I need to do now is actually attach the file submitted in the form to the email I am sending out. But I can't use this same expression in the attachment content field as it doesn't work. How do I get the attachment on to the email?
 
TIA
1 REPLY 1
Super User II
Super User II

HI @James_Anderson 

 

When you get the response details you get a string with an array format that contains the details of the files uploaded.

 

For example:

[{
	"name": "FILE_NAME",
	"link": "https://MYDOMAIN/personal/myaccount/Documents/Apps/Microsoft%20Forms/FORM_NAME/Question/FILE.xls",
	"id": "ID",
	"type": null,
	"size": 123,
	"referenceId": "REF",
	"driveId": "DRIVE",
	"status": 1,
	"uploadSessionUrl": null
}]

 

You can do a parse Json with this format and then have an array that you can Loop and get the ID. Then you can use the Get File and use that ID to be able to attach that in your email.

2020-08-20 11_12_51-Edit your flow _ Power Automate.png

 

Can you please check if and let me know if you have any questions?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

 

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (70,267)