BEFORE you ask "what if the file upload question isn't required?" or say "my flow fails when they don't attach a file", see th-cam.com/video/jBTmX0cm6NU/w-d-xo.html
I have watched five or six videos attempting to teach me this very thing. Yours is the one that actually worked. You have saved me so much headache and frustration. I am incredibly grateful. Well done!
Awesome video.. helped a lot even after 2 years.. thank you. i just wanted to give you an easy solution on being able to get the flow to work when there is no file uploaded: 1) add a Condition after you initialize varAttachments. 2) set the left value to the Dynamic contenet of the uploading question. make it "is equal to" and leave the right value empty. 3) move the Parse JSON to the "If no" section of the condition and move the "Apply to each" right below it (as well in the "If no" section). the logic is this: if there is no file uploaded, the field is empty. so if it empty - there is no reason for all the JSON thing to start.
Thank you so much for this, Chad! This video was extremely helpful and saved me countless hours that I may have wasted searching for these answers elsewhere. I can't thank you enough!
Life saver! I was trying to get this by using some string manipulation with the Link attribute and it wouldn't work. Your approach with using the Get File Metadata first was the trick.
I had followed a different tutorial that was a bit complicated and it ultimately didn't work for me. this was much simpler and it worked on the first try... so THANK YOOOU!
I've actually been working on a new playlist that goes into a bit more detail and (tries to) streamline the process a bit. Check it out here: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
hi chad, thank you for this video. it was very detailed and simple to follow for a beginner user like me. I have been researching on this issue and I was unable to find a suitable solution and was almost close to giving up. But fortunately, I chanced upon your video. Thank you for saving my workflow. I hope you continue making these videos. Thank you so much.
I have followed similar videos with success, but yours streamlines the process and is so much easier to understand! Thank you! I do have one question for you. Is there a way to upload the files without the file name being appended with the uploaders name?
You can't prevent the submitter's name from being appended, but if you're sending the file as an attachment, you can modify the name. See th-cam.com/video/PRwUn0aZysM/w-d-xo.html
Thank you for the video! But I do get a peculiar version of the Error "file unreadable" in a manner, not discussed/addressed in your comments below. A)I run your flow and it creates attachments that are sent via email and are readable B)I format the other text answers into a PDF by creating a file and attaching it to an email. This also works fine on its one (not in your flow) C) If I try to sequentially add the latter PDF file (the created one) to the array that I created from your example, the file is added (extension too) to the array and is sent via email with all other files but is unreadable. What I do is: Create File (fine name, body)--> Get File COntent (Id) --> Append to array { "Name":@{outputs('Create_file-PDF')?['body/DisplayName']}, "ContentBytes":@{body('Create_file-PDF')} } Thank you for any ideas!! PS Alternatively the option of "two" attachments, ie one your array and one my created file does not seem to be possible
My first thought is the formatting of your append. Do you actually have the @{ in front of outputs and body, or are they only showing in your comment because you copied and pasted from your flow? If they're actually in your flow, take those (and the closing } ) out and see if that resolves the issue. If not, please post a message in the Power Automate community (powerusers.microsoft.com/t5/Microsoft-Power-Automate/ct-p/MPACommunity) with a screenshot of how your flow (in particular that append action) is configured.
@@cvkealey Thank you Chad for your reply. The outputs and body were showing that way due to copy/paste . After spending a few hours in various forums before even posting the question, I seem to have uncovered the solution. I introduced Get File Metada between Create File and Get file content.
Hey Chad, what happens if the form itself is owned by a specific user and therefore the file location is on a personal sharepoint drive? That does not seem to be allowed as a file location option in the Get File Metadata step and I am stuck...
As the input for the Get file metadata action, just use the "id" from the Parse JSON output. This will work as long as the author of the flow is also the owner of the form. BTW, this playlist has a bit more detail and might make things a little easier to follow: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
i have a question, how about if the form ask to upload 2 attachments such as: Q1. attachment 1 Q2. attachment 2 so should i need to create initialize variable for Q2 or i need another parse json for Q2
You repeat the "Parse JSON" for each file upload question. What you do with the output of that depends on what you need to do with the files. You can add them all to one array variable, create separate variables, etc. It all comes down to what the requirements are. See this playlist for more detailed information: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
I’ve been trying and trying and my flow kept failing at the metadata. I finally realized that the metadata was being kept on Sharepoint and not one drive. Do you if I can do the same thing except with sharepoint or have it upload to one drive?
All files have metadata, regardless of whether they're stored in OneDrive or SharePoint. How you access that metadata is a little different. Also, where the file ends up depends on whether it's a personal or group form. See this playlist for additional details and information: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
I'm running into issues with Schema. Whether I try to pull it from "Get response details" or use what you listed, it doesn't provide proper values. Any idea what I should do?
Give this a try: th-cam.com/video/OaB2stc6ThM/w-d-xo.html If you still have issues, I would suggest posting a message in the Power Automate community (community.powerplatform.com/forums/thread/?groupid=46ce02a3-e1a7-4176-81fc-d93a4001d287)
Hi I came across your video, followed the steps exact but the emails are coming through as more of a notification with a link to the form to view the results rather than the email message with a copy of the attachment, is this a likely to be a restriction applied by my company?
In Microsoft Forms, there's a setting for each form that allows you to get a notification that the form was submitted. It sounds like that's what you're getting. If you're NOT also getting another email from the flow, I would suggest you take a look at it to determine why. The flow may be failing or simply not doing something you expect.
Hi Chad, I came across your solution to email attachments from Microsoft Forms and thought that I had finally found a solution. Still, I am struggling with the Get File Metadata - it looks like the Parse JSON is getting the right values from the simple form I created (Text question and attachment), but then the folder and file ID are being passed incorrectly, and I cannot figure out why. How can I connect with you to review the code?
I would suggest you take a look at this playlist which has a bunch more information on this topic: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html If you're still having trouble, please post a message in the Power Automate community (community.powerplatform.com/forums/thread/?groupid=46ce02a3-e1a7-4176-81fc-d93a4001d287) with some screenshots of your flow and a description of the problem.
@@cvkealey Do you have a video explaining this? I have Parse JSON 1 - > Initialize variable 1 -> Apply to each 1 -> Parse JSON 2 -> Initialize variable 2 -> Apply to each 2 -> Send an email (V2) and include both appended variables in the attachment field, but am getting an error
You can add them all to one variable, no need for two. This video th-cam.com/video/2mrcTMkwelE/w-d-xo.html and others in this playlist th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html go into more detail.
@@cvkealey Got it! What I wasn't understanding was that I could select which Parse JSON I linked to the Apply to Each loops. Thanks again for these videos. Really helpful.
Question - Does this flow work for the following scenario - File upload question is optional (not mandatory) and the user submits the form without uploading any file/doc ? It gives me an error like this - Unable to process template language expressions in action 'Parse_JSON' inputs at line '0' and column '0': 'Required property 'content' expects a value but got null. Path ''.'. Can you please guide me regarding this?
Hi Chad, first of all, thanks for this tutorial! But i have one question, apparently i follow step by step your instruction but the flow failed in "get file metadata" and the details are "The file id 'xyzxyz' is not valid." Do you have any suggestion?
If you're using a group form (which I am in this video), you need to use [driveId].[Id] as the identifier. A LOT of people miss that . (dot/period) in between, so check that. However, if it's a personal form, you just need the [Id].
@@cvkealey Hi Chad, great Vid but i had similar issue. After I added the dot/period I got the error "The resource could not be found" from 'Action 'Get_file_metadata' failed'. Files are saved on desktop and folders within File Explorer. Any suggestions to fix this? Thanks
@@chantillakhu9365 a Power Automate cloud flow cannot access files stored on a local computer. Files uploaded in MS Forms questions are stored either in OneDrive (if it's a personal form; in this case, you don't need the driveId and dot) or SharePoint (if it's a group form, in this case you DO need the driveId and dot). See this playlist for more information: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
Thanks for the video. After I run a test, it fails because of the ID is not valid. It then changes Content from "file content" to "body" in the Append to Variable Array.
I'm not sure what's wrong or missing to cause that. I have a newer playlist on this topic: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html That goes into a bit more detail on how this all works, so take a look there. If you still have issues, please post a message in Microsoft's Power Automate community. Troubleshooting these kinds of issues via TH-cam comments threads is not very effective.
Yes, it will work whether the files are stored in SharePoint (as they are for group forms) or OneDrive (as they are for personal forms). There are differences in the configuration based on where the files are located. Much more information is available in this playlist: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
Hi Chad. Your videos have helped me out so much. However I was hoping you might be able to help me further. I want to be able to save my form submission as a PDF and attach to an email as well as included an uploaded file to the email as an attachment. I can get them to work individually but can't seem to get them in one email. Any suggestions?
Basically, you need to append the appropriate data (name and content) for all the files to one array variable, then attach that variable in an email action. The office 365 outlook send email actions allow attaching as an array.
@@cvkealeyThanks Chad. I have the Parse JSON action to get the uploaded file -> initalize variable action -> Apply to each (get file metadata>get file content>append variable to array. Does this seem correct so far. I just need to make the values in the append action for both the JSON uploaded file and the convert PDF content?
Yup, you're on the right track. Just add the steps to create the PDF of the response data and then another append to array action to add that to the array of files. You should be able to get the name and content from the convert file action dynamic content.
I'm not sure what you mean by "Power Apps Email". Can you explain in more detail? There are a number of options for sending emails in Power Automate, but not all support attachments. And I know you can also send emails via Power Apps, but I don't know if that handles attachments.
Do you mean the image won't load/display? If so, be sure you're including the file extension. Without the .jpg or .png (or whatever format the image is), most email programs won't know what kind of file it is and won't display it.
Thanks for the awesome tutorial! What can we do if we want to also add the attachment from a second form question? So this would be two attachments from two different form questions. Thank you!
This is totally doable, just repeat the process for each question and append the data to an array variable. You do need to use an email action that allows multiple attachments, such those from the Office 365 Outlook connector.
Any help would be appreciated. This solution was working last week. Now, an email will send with the attachment. However, when going to open, I receive "it looks like we don't support this file format." Additionally, I cannot open docx files either without Word prompting me an error. Any suggestions?
@@cvkealey I would like to think so. After running the Flow and seeing the results. I see under name it will come with a file extension. I am using a jpg. So you see the "name".jpg & even under 'name without extension' it is just "name."
I have a survey with more than 30 multi-file, not mandatory upload questions. I want to use power automate to build Excel with links to these attachments (using friendly name). I would love to call a child flow (that would do the parsing, and retrieving a link) in place where I assign response to Excel column. However that is not possible. Is there better way to handle that case ? All internet solutions says about one or two upload questions. But what if I have so Many?
Hello Chad, I successfully followed this tutorial and got my flow to work. However, if there is no attachment added into the form, which will happen a lot in my case, the parse JSON will give me an error saying "InvalidTemplate. Unable to process template language expressions in action 'Parse_JSON' inputs at line '0' and column '0': 'Required property 'content' expects a value but got null. Path ''.'. I assume it just doesnt like the fact there is no attachment... Would you have a suggestion how I can go around this? Thank you so much
Hi, Thanks for the clear video. Im trying to send image attachment. I have set up my flow just as yours and it runs sucessfully. The issue is that when I open the email attachment, it says 'We couldnt opent the image file'. Even when i download the attachment it says that the format is not supported. Do you have any idea why? thanks again.
Thanks Chad, this worked great once I switched "ContentBytes" to the expression: body('get_file_content').$content rather than using File Content in the append to array variable. One question - Is it possible to separate the attachments? I want some people to receive an email with both attachments, and some to receive only the first one, and I'm not sure how to accomplish that.
Possible? Yes. Easily? Maybe, but maybe not. Basically, it depends on how your form is set up. If you have one "question" that multiple files are uploaded through, unless there are some unique characteristics of each file (like a naming convention that users will never follow), you don't have a way to know which file needs to go to which person. If you have separate questions, you can create separate variables. For example, let's say it's a "business trip request" form and you have one question where they attach/upload a "budget" and a separate one for their "travel plan". Budget files need to go to Finance, while Travel Plans need to go to Legal. Because they are separate questions, you need to parse the json of each individually, so there's a natural split there. I'd probably use parallel branches for each "audience" to keep things organized.
@@cvkealey Thanks for your help. The attachments are indeed in separate questions. I copied everything I had set up for the first attachment and set it up the same way for the second (variable, JSON, apply to each), and it works. Unfortunately, I can't attach two separate variables in the Attachments field under "Send an email (V2)". If I try, it doesn't send any attachments. It only works if I send out two separate emails, one with each attachment. But I want some people to receive both attachments in a single email, and others to only receive one attachment. Do you know if it is possible to include multiple variables in a single email? I might be pushing my luck here..
@@Snozedd you can't specify two variables, but you can use the Union expression to merge the two. In the attachments array, enter the expression "union(firstArrayVariable,secondArrayVariable)" (without the quotes and using the dynamic content selector to choose your variables).
@Snooze : Hi Snooze, I have the same problem. Do you mind elaborating on how exactly you used it? (sorry, I am a novice). I use the expression, as posted in this video's footnotes. If I replace the "Content Bytes" expression with what you posted above, I get a "not valid JSON" error. How exactly did you use "body('get_file_content').$content " ? Thank you for your time.
It's hard to tell without seeing how you have it configured. If you can post a message in the Power Automate community (powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows) with screenshots, I can take a look.
It's difficult to troubleshoot without knowing what you're putting into the file id field. I would suggest posting a message in the Power Automate community (powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows) with some screenshots of how your flow is configured and the exact error message you're getting. You can tag me in the message (@ChadVKealey) and I'll take a look.
@@cvkealey I found your answer about this in a community post! The problem is that I forgot to put a period or dot between driveId and id in the 'Get file metadata' step on 'Apply to each'. It works perfectly now and I'm grateful for your expertise! Thanks!!!
Hi Chad! Great video. I had a question, when I upload multiple documents, apply to each then processes each document on its own and then send two separate emails with both documents attached. Do you know why this may be?
Hi Chad, You were correct. I reapplied I had the email siting inside another apply to each function which was causing the flow to send an email of every attachment that was found in the form. I took it out and it is working perfectly now. Thank you!\@@cvkealey
Are you pasting it straight into the "Schema" field, or using the "generate from sample" button? It should work if you paste it directly into the field.
If it's a group form, make sure you use the proper format for the identifier: . Note that there are no spaces and just a single . between those values.
I followed it step by step but I get an error in Parse Json Step. The error reads: [ { "message": "Invalid type. Expected Array but got Object.", "lineNumber": 0, "linePosition": 0, "path": "", "schemaId": "#", "errorType": "type", "childErrors": [] } ]
It sounds like you may have the wrong schema in that action. The one in the video description (including the opening and closing curly braces) should work.
@@cvkealey I have exactly the same schema. Thanks either way. It's frustrating how Microsoft manages to make something that should be easy so complicated.
Please post a message in the Power Automate Community (powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows) with some screenshots of how your flow is configured. You can tag me there (@ChadVKealey) and I'll take a look.
Hi Chad, thanks for this video. Actually worked and easy to follow. However, what if I have multiple Attachments on a separate question number in MS forms? When I test it, it only gets the first attachment. Hope you can help me on this. Thank you.
You can use a single (array) variable, but you need to repeat the "Parse JSON - get metadata - get content - append to variable" sequence for each file upload question. There are other, more efficient ways to handle it if you have many (e.g.: more than 2 or 3) file upload questions.
@@cvkealey Thanks Chad for your quick response. I'll try (beginner), but I hope you can do a simple video for this one as well. Thanks in advance. Great Work!!
@lloydmichaelrivera6364 I know you can do it! If you can handle it for one question, you can handle it for multiple. Just copy and paste the actions and update the dynamic content. You're just following the same pattern over again.
OMG Thanks very much for this video. What about if i have 2 fields for file upload, for example one before and another oe after the changes? Should i create 2 simmilar flows?
Thanks for your tutorial, it's really helpful. In my scenario, I have 10 questions with attachments (each question can upload up to 2 attachments), how we can add images to the Word template? Also, there is a 10MB limit for Word online? thanks in advance
Sorry, I can't help with Word templates as I don't have a premium license to use that action. This video (th-cam.com/video/qKkTWJGyZ5U/w-d-xo.htmlsi=3_BTX7YmIzl6MubH) may help as far as getting all the file uploads/attachments together into one array. However, getting them into a Word template is out of my realm of experience.
This worked, but if there is no attachment added to the Form I am getting a null error. Is there a way to ignore if there are zero attachments? "Unable to process template language expressions in action 'Parse_JSON' inputs at line '0' and column '0': 'Required property 'content' expects a value but got null. Path ''.'."
You either need to add a condition to check if the response for the file upload question is blank (and only run the parse json if it's NOT null) or you can use the "configure run after" setting on the action (as demonstrated here: th-cam.com/video/jBTmX0cm6NU/w-d-xo.html)
Hi, thanks for your tutorials. I tried doing the same thing here and power automate says the flow is good, I see both attachments written there but email comes with no files whatsoever, please help
I would suggest reviewing the video to be sure you've set things up exactly as shown. If you still have issues, it would be best to post a message in the Power Automate community (powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows) with some screenshots of your flow. You can tag me there (@ChadVKealey).
Ok So when I make the json, if i put the cod in the Generate from sample popup window it strips out the "type": " array" line and i get an error when i run it saying it was expecting an object not an array, But if i past your code in the schema window, with out clicking on the gen sample thing 1st it takes the code and it runs and returns all the information, But when i then try and do the initialize var bit and add the append to array variable, i get an error telling me to "enter A valid Json"
You want to paste that code (from the video's description) straight into the "Schema" field of the Parse JSON action, NOT using the "Generate from sample" button.
Hi Chad, do I need to make changes to attach this to an approval email using the "start and wait for an approval" function. It resulted in an error for me
See this playlist for some updated content on this topic: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html Basically, if it's multiple files in the same question, use an apply to each loop on the output of the parse JSON action to append the relevant data into an array variable. If it's multiple questions, repeat the parse JSON and apply to each for each question. At the end, attach the array to the email (note: not all "send email" actions accept attachments in array format; all the Office 365 Outlook ones do, but others do not).
Hi Chad, Thank you for this valuable tutorial! I need to do this for multiple questions and I repeated (parse JSON and apply to each) for each question but it duplicates the same file for one question only. (I'm using Microsoft Office 365 send an email action) How can I solve this?
The key is to use an array variable to store the attachment info and append each file to it. Are you sure you're using the "Append to array variable" action to "build" that variable? Also, if you copied & pasted actions, be sure you updated the inputs accordingly. When I have a form with multiple file upload questions, I usually put the parse JSON and apply to each (with the get file content and append to array actions inside it) into a Scope. That makes it easy to duplicate (copy & paste the whole scope), but it's critically important to update the inputs (question id) in each copied scope.
No input parameters provided. Please provide required input parameters 'To', 'Subject' and 'Body'. clientRequestId: 02b4fc2b-fd9a-4a25-83c3-209037a05297 can you help with the above error?
@@praveenrashinkar then something in the variable isn't correct. Check the steps where you're appending the file information. Often, people will leave out a quote or comma.
Two Question, How can I add a check if they do not upload a file. Right now it errors out if nothing is uploaded. Second, how can I delete or clean up the files created.
Regarding your first question, see th-cam.com/video/jBTmX0cm6NU/w-d-xo.html As for the second, you have the ID of the file...just add a "Delete file" action.
Thank you so much! I'm having one issue with my use case. I don't require the user to upload an attachment and I get an error in the Parse JSON when they don't upload a file.
Hi Chad, nice video, I have a question, can I send the attach file by Teams and wait to the approve? I want to show the file there but in the option I have an error...
I could be wrong, but I'm pretty sure that you can't "attach" files to messages in Teams the same way you do in Outlook. What you could do is include a LINK to the file(s) in a message. You'd want to ensure that the folks receiving that message in Teams have access to it (or, you could generate a sharing link and use that in the message).
Hi Chad, I was using this flow and it worked perfectly. Now I get an error message for JSON Parse and I saw that the recommendation is to create an if empty condition. I did that and it works now. I am wondering why this has changed. Any insights?
If the file upload question is not required and someone submits the form without an attachment, that parse JSON action will fail (it can't parse non-existent data). You can use a condition to only run that action if there is an attachment or use the "configure run after" property of the subsequent actions to prevent that failure from causing the entire flow to fail.
I have followed your instructions as well as researching other blogs. I get the email but no attachment. I have tried a variety of changes and nothing seems to work. I want to send an attachment from a form response that is stored in my One Drive folder in an email. Please help.
If you can post a message (along with screenshots of your flow) in the Power Users Community (powerusers.microsoft.com/t5/Microsoft-Power-Automate/ct-p/MPACommunity), I can take a look at it. It is a pretty specific process, so maybe re-watch the video and make sure that you've got things configured as shown. It seems to be working fine for others.
It sounds like you may not be selecting the "correct" dynamic content value when populating the attachment array (see 6:04). There might be multiple values called "Name" from different actions; you need to select the one that you want to use as the name of the file.
@@cvkealey took a look. Even on earlier step, get response details, a test output is showing a file name representing the flow, not the file name of the file uploaded. Raw output data show it coming as doc11_flow 13.pdf even though file is called doc11.pdf. What i found is that it seems to just add _flow to the filename, e.g. a pdf called Doc12.pdf would come in the output as doc12_flow.pdf
@JJRimmer normally, the name of the person who uploaded the file is appended to the file name. So, if I uploaded a file called Doc1.docx, it would be named Doc1_Chad Kealey.docx. I've not seen "flow" appended, and I'm not sure why it would be unless the user submitting the form is named "flow".
Incidentally, you don't need to use the actual name of the uploaded file. So, if you wanted to, you could strip off the name of the submitter. See th-cam.com/video/PRwUn0aZysM/w-d-xo.html
This is the best video, and finally got what I wanted working - the Get File Metadata was the answer!! However, I now have a challenge, in that if there are no files attached, mine are not mandatory the parse fails and I assume the rest will email with Array will fail - I assume I need 2 if statements, one for if file is attached, then do the parse and one to send the email if the array is not empty (I have 2 different attachment requests going into a single array var) ???
This video (th-cam.com/video/jBTmX0cm6NU/w-d-xo.html), linked in the description, shows my preferred method for cases where the file upload question is not required.
I got this working in my script but the way i have the form set up is the user is not required to upload a document, it's just an option. The script is failing when it does not see a file uploaded. How would i allow this to skip the send a file in an email step if a file was not uploaded?
@@jessestoner6691 In Power Automate, there are almost always a few different ways to solve a problem. Because of these many variations, it's not possible to describe/demonstrate every different method. I try to focus on the basic concepts and patterns. As long as you found something that works for you, it's all good.
Thank you for this video. However, it appears that the JSON format solution doesn't work these days. I had many solutions based on this format and my flows are dead. Can you confirm the same regression ?
I've got a dozen or so flows using a similar method to get files from Form upload questions and haven't seen any failures recently. I'll double check and do some testing to be sure. How exactly are your flows failing?
@@cvkealey thank you for your quick answer. It's probably my configuration that cause the problem. I have verify the syntax of my json file and the variable. Every thing seems ok. However, when I execute it, my "send an email V2" answers me : "No input parameters provided. Please provide required input parameters 'To', 'Subject' and 'Body'. clientRequestId: 54g12455-cf81-4b69-4545-68f95a45454521ff" Of course, all field are OK. I'm lost. If I don't place the variable on the fonction email. It's working.
So, if you don't include the variable with the attachments, it sends normally? In that case, it must be some to do with that variable. When you initialize it, you are leaving the value blank, correct? And have you verified that you're populating it in the correct format (with the name and content of the file)? One way to check is to add a compose action just before the email and drop the variable into that, then run the flow with an attachment and see what's in the compose action.
Also, if the steps in my previous reply don't help to isolate and fix the issue, it would be great if you could post a message (preferably with some screenshots of your configuration) in the Power Automate community: powerusers.microsoft.com/t5/General-Power-Automate/bd-p/MPAForum
Hi Chad great work. I just have one issue here.. when a requestor 3rd person is uploading a document to the form, the attachment does not open. It shows as unreadable content error for word file and error for jpg. Can you please help.
I'm not sure what you mean by "a requestor 3rd person". But, if the attachment content is formatted correctly, it should work fine. I would suggest double-checking the formatting of that value.
Hi Chad! hope you can help. I created a Form wherein there are 3 attachments. If all 3 have attachments, the power automate works just fine meaning it sends email notification with the 3 attachments. However, if at least one attachment is missing, the power automate is not working. What can I edit in my Flow so that the power automate of sending email notification will still work even if not all attachments are added by responder.
I'm guessing those are associated with 3 separate questions on the form. In that case, you need to account for each of them to potentially be blank/empty. See th-cam.com/video/jBTmX0cm6NU/w-d-xo.html for the pattern I use for non-required file upload questions.
This is great, however my forms are hosted in a Teams Sharepoint site - as such the OneDrive flow steps don't work - Can you share how this flow would need to change to make this work via a Teams Sharepoint site hosted form?
The OneDrive actions work, but you need to build the proper identifier for the file. I cover that in this playlist: Microsoft Forms, Uploaded Files and Power Automate: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
There are a few possible causes. First, make sure the variable is initialized as an "array" (not "string", which is the default type). Next, be sure you're using the Office 365 Outlook "Send an email" action (or another that supports multiple attachments). Finally, make sure that you're switching the Attachments field to "text mode" (if you see two fields there for "name" and "content", it's in "array mode"; click the icon to the right to switch to "text mode").
The best way is to append the relevant information (name and file content) of each to an array, then attach that array to the email. See th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html for more details.
You just need to repeat the "parse json" and related steps for each question. If you want to send all the attachments in a single email, you can append each of them to the same array variable. See this playlist (particularly parts 2 & 3) for more details: th-cam.com/video/Od3y5mfQ8QA/w-d-xo.html
Hi Chad, thank you for this video, i have a question. I want my colleagues to be able to use the form and upload documents and whenever they try to do that, the flow fails and it gives out this error message "You are not authorized to send mail on behalf of the specified sending account. clientRequestId: 4eb3acbb-3b03-4d03-a3fe-3dd3648f8140 serviceRequestId: 753d2a40-c431-02ba-37e9-8fb31be5ed27" Are you able to help me work out what I may be doing wrong?
The flow will always run as you - that's the catch with "automated" flows. I suspect that in your "Send email" action, you're setting the "From" field to the email of the person who submitted the form. Because the flow is running as you, it can only send "From" mailboxes to which you have "Send as" permission. Since you don't have permission to their mailboxes, the message can't be sent. You either need to just have it send as you, or use another method to send the email. I typically set it up to send from a shared or group mailbox (you'd need to talk to your admins to create or get access to one of those).
Hi Chad, this is working really well for me and I have constructed a flow following your instructions to send an email to a different person depending on which option on the Form is selected. So to clarify, the user of the form selects a department and my flow sends an email (with attachments etc) to a different email address depending on which department is selected. I am doing it by a sequence of controls - if Yes send email 1 if No go to the next control which is if Yes send email 2 is No go to next control etc. Am I doing this in the most efficient way?
so, a series of Conditions? That can work (obviously), but there are a few other ways to do it that would be more efficient. In this video, I demonstrate how to do something similar (assign a task, not send an email, but the pattern is the same) using either an array variable in the flow or a lookup to a SharePoint list: th-cam.com/video/uzpS6ZWsvmM/w-d-xo.html. You could also do it using a Switch control (see th-cam.com/video/6KokllQUX2I/w-d-xo.html - not my video, but Flow Joe's got a lot of good stuff)
This is wonderful and runs perfectly, except the files aren't opening. They are attaching to the email but then I get an error that says the documents are either unreadable, or they aren't supported. How do I fix?
Take a look at the files that are attached...do they have the proper file extension? The most common issue I see is that people select "File name without extension" when building the file array. When the attachments arrive without a file extension, the email client doesn't know how to open them.
@@cvkealey Thank you for the quick response! They are labeled correctly and the types are correct. Where would I find the file array where I would've selected the without ext?
You just need to initialize the variable BEFORE the switch. You can only initialize variables at the "root level" of a flow (not INSIDE of a condition, switch, scope or loop). So, initialize it before your switch, then inside the cases, append as needed.
@@cvkealey Thak you, Chad, that helps a lot! However, I now get an error for the action "Get file metadata" and it says that the file id is not valid. I have the exact same flow as you have. I am wondering what could be the reason for that..
BEFORE you ask "what if the file upload question isn't required?" or say "my flow fails when they don't attach a file", see th-cam.com/video/jBTmX0cm6NU/w-d-xo.html
I have watched five or six videos attempting to teach me this very thing. Yours is the one that actually worked. You have saved me so much headache and frustration. I am incredibly grateful. Well done!
Glad it helped!
Completely agree with this statement, great video!
Been struggling for a few days with this, glad I found this video. Great job, thank you!
Awesome video.. helped a lot even after 2 years.. thank you.
i just wanted to give you an easy solution on being able to get the flow to work when there is no file uploaded:
1) add a Condition after you initialize varAttachments.
2) set the left value to the Dynamic contenet of the uploading question.
make it "is equal to" and leave the right value empty.
3) move the Parse JSON to the "If no" section of the condition and move the "Apply to each" right below it (as well in the "If no" section).
the logic is this: if there is no file uploaded, the field is empty.
so if it empty - there is no reason for all the JSON thing to start.
Thanks! I actually prefer using the "run after" settings, as shown here: th-cam.com/video/jBTmX0cm6NU/w-d-xo.html
Thank you so much for this, Chad! This video was extremely helpful and saved me countless hours that I may have wasted searching for these answers elsewhere. I can't thank you enough!
Life saver! I was trying to get this by using some string manipulation with the Link attribute and it wouldn't work. Your approach with using the Get File Metadata first was the trick.
after allllllll of the other video's out there, I'm glad I found this one. This one actually worked for me. Thank you for this information!
Years later this is still incredibly helpful and has just solved a huge headache I was having with getting this going. thank you!
Glad it helped!
Thanks so much. I could not find this specific task on TH-cam or other forums. Very easy to follow along while doing it. Thank you!!!
This is a brilliant video, so clear even for someone like me who understands almost nothing.
This is excellently done - the explanation, best practices and the outcome.
Very clear and easy to follow guide, perfection to be quite honest. Thank you.
Wonderful Job Chad. I've followed both videos and complete my task successfully without errors. Kudos!
still a killer tutorial, helped me figure out my missing (.) in my flow. thank you!
I had followed a different tutorial that was a bit complicated and it ultimately didn't work for me. this was much simpler and it worked on the first try... so THANK YOOOU!
I've actually been working on a new playlist that goes into a bit more detail and (tries to) streamline the process a bit. Check it out here: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
hi chad, thank you for this video. it was very detailed and simple to follow for a beginner user like me. I have been researching on this issue and I was unable to find a suitable solution and was almost close to giving up. But fortunately, I chanced upon your video. Thank you for saving my workflow. I hope you continue making these videos. Thank you so much.
Awesome video, I researched how to do this for a few hours and this was the best resource I found. Thank you!
Glad it was helpful!
This was a HUGE. Thank you for making this. Made my life much easier.
This totally worked!! Well done and thank you, Chad!
SuperB explanation, managed to incorporate this function into my flow using your video guide.
I have followed similar videos with success, but yours streamlines the process and is so much easier to understand! Thank you! I do have one question for you. Is there a way to upload the files without the file name being appended with the uploaders name?
You can't prevent the submitter's name from being appended, but if you're sending the file as an attachment, you can modify the name. See th-cam.com/video/PRwUn0aZysM/w-d-xo.html
was trying to set this for a while. Tks man.
wish you the best.
Thank you so much for posting this! It was fantastic.
Thank you for the video! But I do get a peculiar version of the Error "file unreadable" in a manner, not discussed/addressed in your comments below.
A)I run your flow and it creates attachments that are sent via email and are readable
B)I format the other text answers into a PDF by creating a file and attaching it to an email. This also works fine on its one (not in your flow)
C) If I try to sequentially add the latter PDF file (the created one) to the array that I created from your example, the file is added (extension too) to the array and is sent via email with all other files but is unreadable.
What I do is:
Create File (fine name, body)--> Get File COntent (Id) --> Append to array
{
"Name":@{outputs('Create_file-PDF')?['body/DisplayName']},
"ContentBytes":@{body('Create_file-PDF')}
}
Thank you for any ideas!!
PS
Alternatively the option of "two" attachments, ie one your array and one my created file does not seem to be possible
My first thought is the formatting of your append. Do you actually have the @{ in front of outputs and body, or are they only showing in your comment because you copied and pasted from your flow? If they're actually in your flow, take those (and the closing } ) out and see if that resolves the issue. If not, please post a message in the Power Automate community (powerusers.microsoft.com/t5/Microsoft-Power-Automate/ct-p/MPACommunity) with a screenshot of how your flow (in particular that append action) is configured.
@@cvkealey Thank you Chad for your reply. The outputs and body were showing that way due to copy/paste . After spending a few hours in various forums before even posting the question, I seem to have uncovered the solution. I introduced Get File Metada between Create File and Get file content.
thanks a million!! this was the very last bit I needed to bridge the gap to map an HTTP post to attach something to Jira
Hey Chad, what happens if the form itself is owned by a specific user and therefore the file location is on a personal sharepoint drive? That does not seem to be allowed as a file location option in the Get File Metadata step and I am stuck...
As the input for the Get file metadata action, just use the "id" from the Parse JSON output. This will work as long as the author of the flow is also the owner of the form. BTW, this playlist has a bit more detail and might make things a little easier to follow: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
Super Super usefull, flawless explanation, many thanks my friend
i have a question, how about if the form ask to upload 2 attachments such as:
Q1. attachment 1
Q2. attachment 2
so should i need to create initialize variable for Q2 or i need another parse json for Q2
You repeat the "Parse JSON" for each file upload question. What you do with the output of that depends on what you need to do with the files. You can add them all to one array variable, create separate variables, etc. It all comes down to what the requirements are. See this playlist for more detailed information: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
Thank you so much for posting this!! It is exactly what I needed.
I’ve been trying and trying and my flow kept failing at the metadata. I finally realized that the metadata was being kept on Sharepoint and not one drive. Do you if I can do the same thing except with sharepoint or have it upload to one drive?
All files have metadata, regardless of whether they're stored in OneDrive or SharePoint. How you access that metadata is a little different. Also, where the file ends up depends on whether it's a personal or group form. See this playlist for additional details and information: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
I'm running into issues with Schema. Whether I try to pull it from "Get response details" or use what you listed, it doesn't provide proper values. Any idea what I should do?
Give this a try: th-cam.com/video/OaB2stc6ThM/w-d-xo.html
If you still have issues, I would suggest posting a message in the Power Automate community (community.powerplatform.com/forums/thread/?groupid=46ce02a3-e1a7-4176-81fc-d93a4001d287)
Hi I came across your video, followed the steps exact but the emails are coming through as more of a notification with a link to the form to view the results rather than the email message with a copy of the attachment, is this a likely to be a restriction applied by my company?
In Microsoft Forms, there's a setting for each form that allows you to get a notification that the form was submitted. It sounds like that's what you're getting. If you're NOT also getting another email from the flow, I would suggest you take a look at it to determine why. The flow may be failing or simply not doing something you expect.
Hi Chad, I came across your solution to email attachments from Microsoft Forms and thought that I had finally found a solution. Still, I am struggling with the Get File Metadata - it looks like the Parse JSON is getting the right values from the simple form I created (Text question and attachment), but then the folder and file ID are being passed incorrectly, and I cannot figure out why. How can I connect with you to review the code?
I would suggest you take a look at this playlist which has a bunch more information on this topic: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
If you're still having trouble, please post a message in the Power Automate community (community.powerplatform.com/forums/thread/?groupid=46ce02a3-e1a7-4176-81fc-d93a4001d287) with some screenshots of your flow and a description of the problem.
Worked! I was attaching images as well! Thanks !
Super helpful thanks, but what if we have multiple attachment questions in one form? I can only seem to receive the first attachment, never the others
You need to repeat the process for each question, appending the file information to the same array.
@@cvkealey Do you have a video explaining this? I have Parse JSON 1 - > Initialize variable 1 -> Apply to each 1 -> Parse JSON 2 -> Initialize variable 2 -> Apply to each 2 -> Send an email (V2) and include both appended variables in the attachment field, but am getting an error
You can add them all to one variable, no need for two. This video th-cam.com/video/2mrcTMkwelE/w-d-xo.html and others in this playlist th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html go into more detail.
@@cvkealey Got it! What I wasn't understanding was that I could select which Parse JSON I linked to the Apply to Each loops. Thanks again for these videos. Really helpful.
@@williamhughes47 ah, yeah...it's also important to rename those actions appropriately so you know which action's output you're using!
Question -
Does this flow work for the following scenario -
File upload question is optional (not mandatory) and the user submits the form without uploading any file/doc ?
It gives me an error like this - Unable to process template language expressions in action 'Parse_JSON' inputs at line '0' and column '0': 'Required property 'content' expects a value but got null. Path ''.'.
Can you please guide me regarding this?
See th-cam.com/video/jBTmX0cm6NU/w-d-xo.html
Hi Chad, first of all, thanks for this tutorial!
But i have one question, apparently i follow step by step your instruction but the flow failed in "get file metadata" and the details are "The file id 'xyzxyz' is not valid."
Do you have any suggestion?
If you're using a group form (which I am in this video), you need to use [driveId].[Id] as the identifier. A LOT of people miss that . (dot/period) in between, so check that. However, if it's a personal form, you just need the [Id].
@@cvkealey Hi Chad, great Vid but i had similar issue. After I added the dot/period I got the error "The resource could not be found" from 'Action 'Get_file_metadata' failed'. Files are saved on desktop and folders within File Explorer.
Any suggestions to fix this? Thanks
@@chantillakhu9365 a Power Automate cloud flow cannot access files stored on a local computer. Files uploaded in MS Forms questions are stored either in OneDrive (if it's a personal form; in this case, you don't need the driveId and dot) or SharePoint (if it's a group form, in this case you DO need the driveId and dot). See this playlist for more information: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
Thank you! This was easy to follow and easy to view! Super helpful!
Thanks for the video. After I run a test, it fails because of the ID is not valid. It then changes Content from "file content" to "body" in the Append to Variable Array.
I'm not sure what's wrong or missing to cause that. I have a newer playlist on this topic: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
That goes into a bit more detail on how this all works, so take a look there. If you still have issues, please post a message in Microsoft's Power Automate community. Troubleshooting these kinds of issues via TH-cam comments threads is not very effective.
Awesome help, easy to follow and works perfectly! Thank you
Having trouble following these steps for sharepoint. Does it work for sharepoint too or just one drive? Thanks.
Yes, it will work whether the files are stored in SharePoint (as they are for group forms) or OneDrive (as they are for personal forms). There are differences in the configuration based on where the files are located. Much more information is available in this playlist: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
Hi Chad. Your videos have helped me out so much. However I was hoping you might be able to help me further. I want to be able to save my form submission as a PDF and attach to an email as well as included an uploaded file to the email as an attachment. I can get them to work individually but can't seem to get them in one email. Any suggestions?
Basically, you need to append the appropriate data (name and content) for all the files to one array variable, then attach that variable in an email action. The office 365 outlook send email actions allow attaching as an array.
@@cvkealeyThanks Chad. I have the Parse JSON action to get the uploaded file -> initalize variable action -> Apply to each (get file metadata>get file content>append variable to array. Does this seem correct so far. I just need to make the values in the append action for both the JSON uploaded file and the convert PDF content?
Yup, you're on the right track. Just add the steps to create the PDF of the response data and then another append to array action to add that to the array of files. You should be able to get the name and content from the convert file action dynamic content.
This was very helpful and intuitive. Thank you very much.
Great Job Mr. Chad
This was excellent thank you so much! Solved my problem.
Hey Chad - I completed this but am only receiving one file in the email that is generated. What could that be?
Is your "send email" action inside an "apply to each" loop?
If I want to add a conditional to this for when there is no attachment, what is the right point to do so?
See th-cam.com/video/jBTmX0cm6NU/w-d-xo.html
Hi Chad, thanks for the tutorial. May I know how to send the Power Apps Email instead of Outlook one?
I'm not sure what you mean by "Power Apps Email". Can you explain in more detail? There are a number of options for sending emails in Power Automate, but not all support attachments. And I know you can also send emails via Power Apps, but I don't know if that handles attachments.
Is there a way to fix the upload? When email is sent out, the picture (jpeg) won't upload.
Do you mean the image won't load/display? If so, be sure you're including the file extension. Without the .jpg or .png (or whatever format the image is), most email programs won't know what kind of file it is and won't display it.
Can anyone help? I am getring error in parse json step as 'content property of actions of type parsejs9n must be valid json'
It sounds like you may not be selecting a file upload question as the input for that action or you entered an incorrect schema.
See this video for how to get the correct schema: th-cam.com/video/OaB2stc6ThM/w-d-xo.html
Great content, thank you very much from Colombia 👏
Thanks for the awesome tutorial! What can we do if we want to also add the attachment from a second form question? So this would be two attachments from two different form questions.
Thank you!
This is totally doable, just repeat the process for each question and append the data to an array variable. You do need to use an email action that allows multiple attachments, such those from the Office 365 Outlook connector.
See th-cam.com/video/qKkTWJGyZ5U/w-d-xo.html for more details
Any help would be appreciated. This solution was working last week. Now, an email will send with the attachment. However, when going to open, I receive "it looks like we don't support this file format." Additionally, I cannot open docx files either without Word prompting me an error. Any suggestions?
Are you certain you're including the appropriate file extension? The "name" property doesn't include it.
@@cvkealey I would like to think so. After running the Flow and seeing the results. I see under name it will come with a file extension. I am using a jpg. So you see the "name".jpg & even under 'name without extension' it is just "name."
Im having an error where the attachment does not open from the email received. How do i fix this?
The most common cause is forgetting the file extension. Look at the flow run to be sure the file name with the correct extension is used.
I have a survey with more than 30 multi-file, not mandatory upload questions. I want to use power automate to build Excel with links to these attachments (using friendly name). I would love to call a child flow (that would do the parsing, and retrieving a link) in place where I assign response to Excel column. However that is not possible. Is there better way to handle that case ? All internet solutions says about one or two upload questions. But what if I have so Many?
Hello Chad, I successfully followed this tutorial and got my flow to work. However, if there is no attachment added into the form, which will happen a lot in my case, the parse JSON will give me an error saying "InvalidTemplate. Unable to process template language expressions in action 'Parse_JSON' inputs at line '0' and column '0': 'Required property 'content' expects a value but got null. Path ''.'. I assume it just doesnt like the fact there is no attachment... Would you have a suggestion how I can go around this? Thank you so much
Look in the description of the video. There's a link to another video showing how to address this.
Thank you Chad
Chad, I am getting a run time error when a user DOESN'T include an attachment. Can you provide a workaround. Thanks!
Sure...see th-cam.com/video/jBTmX0cm6NU/w-d-xo.html
Hello Chad,
Do you know how can I upload a picture taken from my iphone without having any drive assigned?
Hi,
Thanks for the clear video. Im trying to send image attachment. I have set up my flow just as yours and it runs sucessfully. The issue is that when I open the email attachment, it says 'We couldnt opent the image file'. Even when i download the attachment it says that the format is not supported. Do you have any idea why? thanks again.
figured it out! It was a formatting issue in the append to array step. thanks
Thanks Chad, this worked great once I switched "ContentBytes" to the expression: body('get_file_content').$content rather than using File Content in the append to array variable.
One question - Is it possible to separate the attachments? I want some people to receive an email with both attachments, and some to receive only the first one, and I'm not sure how to accomplish that.
Possible? Yes. Easily? Maybe, but maybe not. Basically, it depends on how your form is set up. If you have one "question" that multiple files are uploaded through, unless there are some unique characteristics of each file (like a naming convention that users will never follow), you don't have a way to know which file needs to go to which person. If you have separate questions, you can create separate variables. For example, let's say it's a "business trip request" form and you have one question where they attach/upload a "budget" and a separate one for their "travel plan". Budget files need to go to Finance, while Travel Plans need to go to Legal. Because they are separate questions, you need to parse the json of each individually, so there's a natural split there. I'd probably use parallel branches for each "audience" to keep things organized.
@@cvkealey Thanks for your help. The attachments are indeed in separate questions. I copied everything I had set up for the first attachment and set it up the same way for the second (variable, JSON, apply to each), and it works. Unfortunately, I can't attach two separate variables in the Attachments field under "Send an email (V2)". If I try, it doesn't send any attachments. It only works if I send out two separate emails, one with each attachment. But I want some people to receive both attachments in a single email, and others to only receive one attachment. Do you know if it is possible to include multiple variables in a single email? I might be pushing my luck here..
@@Snozedd you can't specify two variables, but you can use the Union expression to merge the two. In the attachments array, enter the expression "union(firstArrayVariable,secondArrayVariable)" (without the quotes and using the dynamic content selector to choose your variables).
@@cvkealey That worked perfectly. Thanks a ton Chad, you saved me a lot of time!
@Snooze : Hi Snooze, I have the same problem. Do you mind elaborating on how exactly you used it? (sorry, I am a novice).
I use the expression, as posted in this video's footnotes. If I replace the "Content Bytes" expression with what you posted above, I get a "not valid JSON" error. How exactly did you use "body('get_file_content').$content " ?
Thank you for your time.
I'm getting this error in my meta data look up. Any idea why? The response is not in a JSON format Action 'Get_filemetadata' failed
It's hard to tell without seeing how you have it configured. If you can post a message in the Power Automate community (powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows) with screenshots, I can take a look.
A question:
the files are being saved with my name at the end of their names..
how do i prevent it from happening?
See th-cam.com/video/PRwUn0aZysM/w-d-xo.html
Hey Chad! Thanks for this! I keep getting the error Action 'Get_file_metadata' failed. It says the file id is not valid. Any ideas?
It's difficult to troubleshoot without knowing what you're putting into the file id field. I would suggest posting a message in the Power Automate community (powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows) with some screenshots of how your flow is configured and the exact error message you're getting. You can tag me in the message (@ChadVKealey) and I'll take a look.
@@cvkealey I found your answer about this in a community post! The problem is that I forgot to put a period or dot between driveId and id in the 'Get file metadata' step on 'Apply to each'. It works perfectly now and I'm grateful for your expertise! Thanks!!!
Hi Chad! Great video. I had a question, when I upload multiple documents, apply to each then processes each document on its own and then send two separate emails with both documents attached. Do you know why this may be?
It sounds like your email action is inside a loop...moving it out of the loop should help or at least minimize the number of emails.
Hi Chad, You were correct. I reapplied I had the email siting inside another apply to each function which was causing the flow to send an email of every attachment that was found in the form. I took it out and it is working perfectly now. Thank you!\@@cvkealey
Hi Chad,
I keep getting a Parse error when trying to use your schema, any suggestions?
Are you pasting it straight into the "Schema" field, or using the "generate from sample" button? It should work if you paste it directly into the field.
I am getting error in "Get File Metadata" .
Error: The resource could not be found.
If it's a group form, make sure you use the proper format for the identifier: .
Note that there are no spaces and just a single . between those values.
I followed it step by step but I get an error in Parse Json Step. The error reads: [
{
"message": "Invalid type. Expected Array but got Object.",
"lineNumber": 0,
"linePosition": 0,
"path": "",
"schemaId": "#",
"errorType": "type",
"childErrors": []
}
]
It sounds like you may have the wrong schema in that action. The one in the video description (including the opening and closing curly braces) should work.
@@cvkealey I have exactly the same schema. Thanks either way. It's frustrating how Microsoft manages to make something that should be easy so complicated.
Please post a message in the Power Automate Community (powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows) with some screenshots of how your flow is configured. You can tag me there (@ChadVKealey) and I'll take a look.
Hi Chad, thanks for this video. Actually worked and easy to follow. However, what if I have multiple Attachments on a separate question number in MS forms? When I test it, it only gets the first attachment. Hope you can help me on this. Thank you.
You can use a single (array) variable, but you need to repeat the "Parse JSON - get metadata - get content - append to variable" sequence for each file upload question. There are other, more efficient ways to handle it if you have many (e.g.: more than 2 or 3) file upload questions.
@@cvkealey Thanks Chad for your quick response. I'll try (beginner), but I hope you can do a simple video for this one as well. Thanks in advance. Great Work!!
@lloydmichaelrivera6364 I know you can do it! If you can handle it for one question, you can handle it for multiple. Just copy and paste the actions and update the dynamic content. You're just following the same pattern over again.
@@cvkealey I'll try, Thanks again Chad.
OMG Thanks very much for this video.
What about if i have 2 fields for file upload, for example one before and another oe after the changes?
Should i create 2 simmilar flows?
No need for another flow, just repeat the same steps in the same flow for the other question.
Thanks for your tutorial, it's really helpful. In my scenario, I have 10 questions with attachments (each question can upload up to 2 attachments), how we can add images to the Word template? Also, there is a 10MB limit for Word online? thanks in advance
Sorry, I can't help with Word templates as I don't have a premium license to use that action. This video (th-cam.com/video/qKkTWJGyZ5U/w-d-xo.htmlsi=3_BTX7YmIzl6MubH) may help as far as getting all the file uploads/attachments together into one array. However, getting them into a Word template is out of my realm of experience.
This worked, but if there is no attachment added to the Form I am getting a null error. Is there a way to ignore if there are zero attachments?
"Unable to process template language expressions in action 'Parse_JSON' inputs at line '0' and column '0': 'Required property 'content' expects a value but got null. Path ''.'."
You either need to add a condition to check if the response for the file upload question is blank (and only run the parse json if it's NOT null) or you can use the "configure run after" setting on the action (as demonstrated here: th-cam.com/video/jBTmX0cm6NU/w-d-xo.html)
Hi, thanks for your tutorials. I tried doing the same thing here and power automate says the flow is good, I see both attachments written there but email comes with no files whatsoever, please help
I would suggest reviewing the video to be sure you've set things up exactly as shown. If you still have issues, it would be best to post a message in the Power Automate community (powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows) with some screenshots of your flow. You can tag me there (@ChadVKealey).
Ok So when I make the json, if i put the cod in the Generate from sample popup window it strips out the "type": " array" line and i get an error when i run it saying it was expecting an object not an array, But if i past your code in the schema window, with out clicking on the gen sample thing 1st it takes the code and it runs and returns all the information, But when i then try and do the initialize var bit and add the append to array variable, i get an error telling me to "enter A valid Json"
You want to paste that code (from the video's description) straight into the "Schema" field of the Parse JSON action, NOT using the "Generate from sample" button.
@@cvkealey Thanks for the replies, watched your video another 5 times and finally resiled i was missing a , so got it to work.
@@TCJones yeah...that happens to me as well. JSON is very particular about its commas, quotes and other punctuation.
Hi Chad, do I need to make changes to attach this to an approval email using the "start and wait for an approval" function. It resulted in an error for me
The Approvals connector needs the attachment to be formatted just a little different. See th-cam.com/video/Xq6DWuEt-Bw/w-d-xo.html
Hello Chad, excelent video but what about upload multiple files?
See this playlist for some updated content on this topic: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
Basically, if it's multiple files in the same question, use an apply to each loop on the output of the parse JSON action to append the relevant data into an array variable. If it's multiple questions, repeat the parse JSON and apply to each for each question. At the end, attach the array to the email (note: not all "send email" actions accept attachments in array format; all the Office 365 Outlook ones do, but others do not).
Fantastic, Chad. Many thanks!!
Glad you found it helpful! If you want to do more with those files, see these videos: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
Hi Chad,
Thank you for this valuable tutorial!
I need to do this for multiple questions and I repeated (parse JSON and apply to each) for each question but it duplicates the same file for one question only. (I'm using Microsoft Office 365 send an email action)
How can I solve this?
The key is to use an array variable to store the attachment info and append each file to it. Are you sure you're using the "Append to array variable" action to "build" that variable? Also, if you copied & pasted actions, be sure you updated the inputs accordingly. When I have a form with multiple file upload questions, I usually put the parse JSON and apply to each (with the get file content and append to array actions inside it) into a Scope. That makes it easy to duplicate (copy & paste the whole scope), but it's critically important to update the inputs (question id) in each copied scope.
No input parameters provided. Please provide required input parameters 'To', 'Subject' and 'Body'.
clientRequestId: 02b4fc2b-fd9a-4a25-83c3-209037a05297
can you help with the above error?
Have you specified the recipient, subject and body in the send email action?
@@cvkealey yes I have. When I remove the 'VarAttachments' from attachments field the email is sent.
@@praveenrashinkar then something in the variable isn't correct. Check the steps where you're appending the file information. Often, people will leave out a quote or comma.
Two Question, How can I add a check if they do not upload a file. Right now it errors out if nothing is uploaded. Second, how can I delete or clean up the files created.
Regarding your first question, see th-cam.com/video/jBTmX0cm6NU/w-d-xo.html
As for the second, you have the ID of the file...just add a "Delete file" action.
Thank you so much! I'm having one issue with my use case. I don't require the user to upload an attachment and I get an error in the Parse JSON when they don't upload a file.
Read the video description. There's a link in the third paragraph to another video with the answer.
@@cvkealey thanks. Yeah, I saw that after my comment. Duh me
Hi Chad, nice video, I have a question, can I send the attach file by Teams and wait to the approve? I want to show the file there but in the option I have an error...
I could be wrong, but I'm pretty sure that you can't "attach" files to messages in Teams the same way you do in Outlook. What you could do is include a LINK to the file(s) in a message. You'd want to ensure that the folks receiving that message in Teams have access to it (or, you could generate a sharing link and use that in the message).
Hello together, grate video!!
Any way to apply this without the user data for the anonymous data transfer though the functions account ??
I'm not sure what you mean by "without the user data" or "functions account". Could you explain a bit more about what you're trying to accomplish?
Hi Chad, I was using this flow and it worked perfectly. Now I get an error message for JSON Parse and I saw that the recommendation is to create an if empty condition. I did that and it works now. I am wondering why this has changed. Any insights?
If the file upload question is not required and someone submits the form without an attachment, that parse JSON action will fail (it can't parse non-existent data). You can use a condition to only run that action if there is an attachment or use the "configure run after" property of the subsequent actions to prevent that failure from causing the entire flow to fail.
Thank you so much for this video. Everything worked just as I needed!
I have followed your instructions as well as researching other blogs. I get the email but no attachment. I have tried a variety of changes and nothing seems to work. I want to send an attachment from a form response that is stored in my One Drive folder in an email. Please help.
If you can post a message (along with screenshots of your flow) in the Power Users Community (powerusers.microsoft.com/t5/Microsoft-Power-Automate/ct-p/MPACommunity), I can take a look at it. It is a pretty specific process, so maybe re-watch the video and make sure that you've got things configured as shown. It seems to be working fine for others.
Legend, thanks.
Just need to figure out why its not holding original file name but renaming it to the flow with a number
It sounds like you may not be selecting the "correct" dynamic content value when populating the attachment array (see 6:04). There might be multiple values called "Name" from different actions; you need to select the one that you want to use as the name of the file.
@@cvkealey took a look. Even on earlier step, get response details, a test output is showing a file name representing the flow, not the file name of the file uploaded. Raw output data show it coming as doc11_flow 13.pdf even though file is called doc11.pdf. What i found is that it seems to just add _flow to the filename, e.g. a pdf called Doc12.pdf would come in the output as doc12_flow.pdf
@JJRimmer normally, the name of the person who uploaded the file is appended to the file name. So, if I uploaded a file called Doc1.docx, it would be named Doc1_Chad Kealey.docx. I've not seen "flow" appended, and I'm not sure why it would be unless the user submitting the form is named "flow".
Incidentally, you don't need to use the actual name of the uploaded file. So, if you wanted to, you could strip off the name of the submitter. See th-cam.com/video/PRwUn0aZysM/w-d-xo.html
This is the best video, and finally got what I wanted working - the Get File Metadata was the answer!! However, I now have a challenge, in that if there are no files attached, mine are not mandatory the parse fails and I assume the rest will email with Array will fail - I assume I need 2 if statements, one for if file is attached, then do the parse and one to send the email if the array is not empty (I have 2 different attachment requests going into a single array var) ???
This video (th-cam.com/video/jBTmX0cm6NU/w-d-xo.html), linked in the description, shows my preferred method for cases where the file upload question is not required.
I got this working in my script but the way i have the form set up is the user is not required to upload a document, it's just an option. The script is failing when it does not see a file uploaded. How would i allow this to skip the send a file in an email step if a file was not uploaded?
See th-cam.com/video/jBTmX0cm6NU/w-d-xo.html
@@cvkealey This didn't exactly work for me BUT it helped me understand how to fix my exact situation. THANK YOU!
@@jessestoner6691 In Power Automate, there are almost always a few different ways to solve a problem. Because of these many variations, it's not possible to describe/demonstrate every different method. I try to focus on the basic concepts and patterns. As long as you found something that works for you, it's all good.
Thank you for this video.
However, it appears that the JSON format solution doesn't work these days. I had many solutions based on this format and my flows are dead.
Can you confirm the same regression ?
I've got a dozen or so flows using a similar method to get files from Form upload questions and haven't seen any failures recently. I'll double check and do some testing to be sure. How exactly are your flows failing?
@@cvkealey thank you for your quick answer.
It's probably my configuration that cause the problem.
I have verify the syntax of my json file and the variable. Every thing seems ok.
However, when I execute it, my "send an email V2" answers me :
"No input parameters provided. Please provide required input parameters 'To', 'Subject' and 'Body'.
clientRequestId: 54g12455-cf81-4b69-4545-68f95a45454521ff"
Of course, all field are OK.
I'm lost.
If I don't place the variable on the fonction email. It's working.
Thank you for this video.
Sorry, if I was too alarming.
So, if you don't include the variable with the attachments, it sends normally? In that case, it must be some to do with that variable. When you initialize it, you are leaving the value blank, correct? And have you verified that you're populating it in the correct format (with the name and content of the file)? One way to check is to add a compose action just before the email and drop the variable into that, then run the flow with an attachment and see what's in the compose action.
Also, if the steps in my previous reply don't help to isolate and fix the issue, it would be great if you could post a message (preferably with some screenshots of your configuration) in the Power Automate community: powerusers.microsoft.com/t5/General-Power-Automate/bd-p/MPAForum
Hi Chad, is it possible to attach the Forms form as an attachment to the email? Thnx in advance for your reaction!
Sure! See th-cam.com/video/D_VD1MJemmM/w-d-xo.html for how to create a PDF of the form data, then just add that file to the email's attachments.
@@cvkealey thnx a lot!
Hi Chad great work. I just have one issue here.. when a requestor 3rd person is uploading a document to the form, the attachment does not open. It shows as unreadable content error for word file and error for jpg. Can you please help.
I'm not sure what you mean by "a requestor 3rd person". But, if the attachment content is formatted correctly, it should work fine. I would suggest double-checking the formatting of that value.
Hi Chad! hope you can help. I created a Form wherein there are 3 attachments. If all 3 have attachments, the power automate works just fine meaning it sends email notification with the 3 attachments. However, if at least one attachment is missing, the power automate is not working. What can I edit in my Flow so that the power automate of sending email notification will still work even if not all attachments are added by responder.
I'm guessing those are associated with 3 separate questions on the form. In that case, you need to account for each of them to potentially be blank/empty. See th-cam.com/video/jBTmX0cm6NU/w-d-xo.html for the pattern I use for non-required file upload questions.
@@cvkealey thanks so much for your prompt reply Chad! I'll try this.
This is great, however my forms are hosted in a Teams Sharepoint site - as such the OneDrive flow steps don't work - Can you share how this flow would need to change to make this work via a Teams Sharepoint site hosted form?
The OneDrive actions work, but you need to build the proper identifier for the file. I cover that in this playlist: Microsoft Forms, Uploaded Files and Power Automate: th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html
@@cvkealey Thanks Chad - that helped - Great videos !!
For some reason the variable doesnt show in the send email step. I am not sure why. Any ideas?
There are a few possible causes. First, make sure the variable is initialized as an "array" (not "string", which is the default type). Next, be sure you're using the Office 365 Outlook "Send an email" action (or another that supports multiple attachments). Finally, make sure that you're switching the Attachments field to "text mode" (if you see two fields there for "name" and "content", it's in "array mode"; click the icon to the right to switch to "text mode").
What do I have to do to send 2 attchments uploaded to the same form?
The best way is to append the relevant information (name and file content) of each to an array, then attach that array to the email. See th-cam.com/play/PLMVyjgrWIGnwQowO2RsvHg0pZ8EozvAG-.html for more details.
@@cvkealey Thanks a lot, this is very very very helpful
I have two fields (No 2 & No 3) to upload files, can you please change the flow in this case?
You just need to repeat the "parse json" and related steps for each question. If you want to send all the attachments in a single email, you can append each of them to the same array variable. See this playlist (particularly parts 2 & 3) for more details: th-cam.com/video/Od3y5mfQ8QA/w-d-xo.html
Hi Chad, thank you for this video, i have a question. I want my colleagues to be able to use the form and upload documents and whenever they try to do that, the flow fails and it gives out this error message "You are not authorized to send mail on behalf of the specified sending account.
clientRequestId: 4eb3acbb-3b03-4d03-a3fe-3dd3648f8140
serviceRequestId: 753d2a40-c431-02ba-37e9-8fb31be5ed27"
Are you able to help me work out what I may be doing wrong?
The flow will always run as you - that's the catch with "automated" flows. I suspect that in your "Send email" action, you're setting the "From" field to the email of the person who submitted the form. Because the flow is running as you, it can only send "From" mailboxes to which you have "Send as" permission. Since you don't have permission to their mailboxes, the message can't be sent. You either need to just have it send as you, or use another method to send the email. I typically set it up to send from a shared or group mailbox (you'd need to talk to your admins to create or get access to one of those).
Thank you, I will give that a try@@cvkealey
Hi Chad, this is working really well for me and I have constructed a flow following your instructions to send an email to a different person depending on which option on the Form is selected. So to clarify, the user of the form selects a department and my flow sends an email (with attachments etc) to a different email address depending on which department is selected. I am doing it by a sequence of controls - if Yes send email 1 if No go to the next control which is if Yes send email 2 is No go to next control etc. Am I doing this in the most efficient way?
so, a series of Conditions? That can work (obviously), but there are a few other ways to do it that would be more efficient. In this video, I demonstrate how to do something similar (assign a task, not send an email, but the pattern is the same) using either an array variable in the flow or a lookup to a SharePoint list: th-cam.com/video/uzpS6ZWsvmM/w-d-xo.html. You could also do it using a Switch control (see th-cam.com/video/6KokllQUX2I/w-d-xo.html - not my video, but Flow Joe's got a lot of good stuff)
This is wonderful and runs perfectly, except the files aren't opening. They are attaching to the email but then I get an error that says the documents are either unreadable, or they aren't supported. How do I fix?
Take a look at the files that are attached...do they have the proper file extension? The most common issue I see is that people select "File name without extension" when building the file array. When the attachments arrive without a file extension, the email client doesn't know how to open them.
@@cvkealey Thank you for the quick response! They are labeled correctly and the types are correct. Where would I find the file array where I would've selected the without ext?
@@cvkealey I figured it out! There were extra quotation marks in the array. Thank you again!
Could yoj please show how it would work with the attachment function in the e-mail, as I cannot initialize a variable in a SWITCH.
You just need to initialize the variable BEFORE the switch. You can only initialize variables at the "root level" of a flow (not INSIDE of a condition, switch, scope or loop). So, initialize it before your switch, then inside the cases, append as needed.
Also, see this playlist for a more detailed and complete look at this topic: th-cam.com/video/Od3y5mfQ8QA/w-d-xo.html
@@cvkealey Thak you, Chad, that helps a lot! However, I now get an error for the action "Get file metadata" and it says that the file id is not valid. I have the exact same flow as you have. I am wondering what could be the reason for that..
@@mariajauslin1107 you have a period (.) in the middle, between the driveId and the identifier?
@@cvkealey yes!!! That was it. Thank you!