Save Microsoft Forms Attachments to SharePoint with Power Automate
Vložit
- čas přidán 11. 07. 2024
- See how to save Microsoft Forms Attachments to SharePoint with Power Automate. I’ll walk you through creating a Microsoft Form with an attachment. Next, I’ll show you where Microsoft Forms Attachments are saved. I’ll then use Power Automate to create a flow that will save the Microsoft Forms Attachments to SharePoint as a list attachment or upload them to a document library.
Functions Used:
Get File Name: first(body('Parse_JSON'))?['name']
Note: The demo I show is of a Personal Form in Microsoft Forms, which is why the data is stored in OneDrive for Business. If you created your form as a Group Form then the file is stored in the SharePoint Document Library of the group instead. Loryan Strant has a great article on this: www.loryanstrant.com/2019/11/...
To learn more about expressions-
aka.ms/learnexpressions
|Table of Contents:
00:00 - Intro
00:48 - Setting up the Form: Add File Attachment
01:36 - Configure the SharePoint List
02:10 - Setting up the Flow
03:35 - Getting the Attachment Data
04:20 - Finding where the attachment is stored
06:09 - Getting the file name
08:27 - Retrieving the File Content from OneDrive
10:10 - Adding the file as an attachment in SharePoint
10:50 - Demo: Forms attachment to SharePoint List
11:27 - Add file to document library in SharePoint - Věda a technologie
Important Note: The demo I show is of a Personal Form in Microsoft Forms, which is why the data is stored in OneDrive for Business. We also have the ability to create Group Forms in Microsoft Forms. This means, instead of the form and attachments being tied to the person who created it, it is associate with a Group and the attachments then are stored in the SharePoint Document library of the group. So if that's how you create your form you might not need this process. If you need to move the attachment to a different SharePoint library the only change is to use the "Get File" SharePoint Action instead of the "Get File" OneDrive action. Everything else is the same.
Actually, the "Get File" SharePoint action doesn't work to move those files attached to Group Forms because the "id" of the file that's provided in the JSON from the response details isn't the same as the "id" needed by the Get File action. You actually need to use the OneDrive actions to "Get file metadata" of the attachment, feeding it the "driveId" and "id" (concatenating them with a . in between) from the JSON, then user the Id output of that action with the OneDrive "Get file content" and THEN the SharePoint "Create file" action. It's a pain, but does work.
Thanks so much. Worked for me, however how do I get the 'attachments' field to show first in the columns of the list? Many thanks.
@@cvkealey thank you!!
@@vlakdrak4774 see support.microsoft.com/en-us/office/change-the-column-order-in-a-list-or-library-6f14f5a4-1df4-48a8-a57b-dc1b8f8d03d2
Please do a video on this - lost me
I had a workflow before, much more complex with a Array function, i made it again following this tutorial, worked perfectly, congrats for the video, clear, straight to the point!!!!
THANK YOU SOOOOO MUCH April! This helps me a lotttt!! I have tried so many ways from other bloggers and youdubers and all failed because they are not as detailed! I love all the content you have posted! YOU ARE THE BEST!! THANK YOU SO MUCH!!
Holy crap!!! This is exactly what I have been trying to accomplish for weeks!! I was even told by a so-called 'expert' that due to limitations in Power Automate, it was not possible to retrieve file names of attachments if there was more than one. I have spent all day trying to come up with a believable sob story as to why I could not fulfill this requirement, but thanks to you, I can save the day, and make myself appear 100 times more capable than I really am. I'm going to take full credit for figuring it out myself, but I'll always know that it was all you! 😉Thank you! thank you! thank you! This was HUGE for me.😃
Well I'm glad that I could help!! 😀
April, your videos make me constantly want to learn more! Thank you for these videos.
I'm so glad to hear that! You're very welcome 🙂
So glad I found your video - I've been playing around with this for weeks and after following your steps I got it working in under 5 minutes!
Fantastic! Glad this was helpful!
This is so amazing. I love how clear an step-by-step you have provided this information. I have been struggling and you have my perfect answer. I can't thank you enough!!
I'm glad that I could help!
Your videos are the best! So well explained and thorough. You save me so much headache. THANK YOU, THANK YOU, THANK YOU!
Thank you, you saved me from a nervous breakdown. Finally a clear flow to save Forms attachments.
Glad I could help!
This has been SO helpful. I thought this will be easy I can just figure it out myself, and boy was I WRONG!
April, this video was very clear and scoped perfectly. Great job!
Thanks Lawrence!
This is brilliant!! Thank you! I have been trying for days to find a video showing how to do this that actually works!
You're very welcome, glad it helped!
Thank you April. This video was fantastic. I did try to replace the expressions with the name for the Parse Json as you described for uploading more than one file, although I had an issue whereby the attachments would not open. I realised that I had an 'apply to each' for both the get file content and add attachment. It is worth noting in case others have this issue, the get file content and add attachment needs to be wrapped in the same apply to each.
This is more complicated than it looks and I still can't get it to work. April, it would be a great video to walk us through the whole thing with multiple attachments. It's not obvious for non-developers...
Hi April. Wow! I followed your steps and it actually worked first time - I am super impressed and thank you so much!
Yay! Love when it works the first time :)
You're our Queen. Thank you so much for your time and simple instructions.
Thankyou for the vid - I have been struggling parsing the JSON until I saw this. Awesome.
You're welcome!
YES! THANK YOU! Been looking all morning for this solution. Much appreciated
Glad to help!!
Great tutorial! It's so good, it was recommended in the power community as a solution! Thanks.
Oh wow, that's awesome!
This is exactly what I am looking for. Thank you! 😊
You’re welcome 😊
This was extremely helpful and just what I was looking for. Thanks for your clear explanation and detail. This actually helped me learn a couple of other things as well that I’d been wondering about!
I'm so happy to hear that. Glad I could help!
Another great Video April! Thanks so much for helping me automate my business
You are so welcome Lauren!
Thanks so much for this! I think i would have spent ages trying to figure this out.
You're very welcome!
Thank you, April, this was very helpful! An easy and elegant way... 🙂
Glad it was helpful!
Thank you so much April. It worked!
Awesome, glad it worked for you!
Awesome video, April! Love your channel.
Thank you so much!
Awesome work and very useful video, April. Keep it going ! 👌
Thank you so much!
I'd happily pay you hundreds of dollars for the information you just shared! Thanks!
Thank you I appreciate that!
@@AprilDunnam do you have a link to the video you referenced at the beginning? Moving forms data to a list?
Another fantastic video April!
Thanks so much!
Thank you so much April, exactly what I needed
You are so welcome!
Thank you so much! I never comment.
This was incredibly helpful.
You're welcome! Glad it helped!
Thank God for pause because you sprinted through this process. :)
Fun fact: You can also adjust the playback speed of a video by clicking the settings gear in the video. Maybe you can try that next time if the FREE content you're watching isn't at your preferred pace. Could prevent you from having to leave passive aggressive comments on other videos :)
Thanks for the video. Very helpful.
You're welcome, glad it was helpful!
Thank you a lot April, this was very very helpful !!!
Glad it was helpful!
Hi April!!! Thank you so much for this video. I was finally able to get it to work and am DELIGHTED!
I'm so glad it worked!
@@AprilDunnam my flow is being funky. Uploading a file is not mandatory and there will be instances where a file will not be present. Do I have to do a yes/no condition?
I can't tell you how often I come back to this great video for instruction. Thank you SO much April.
Any chance of you making a video if there are TWO attachments within the same form that you need in the same SharePoint list?
Thanks for this video! It was very useful :D It worked successfully!
Yay! Glad it worked :)
Great explanation, you've saved me many hours! Thank you
Yay! So happy to hear that 🙂
Thanks a lot, this was helpful and you covered everything, yes I tried this in a Group in SharePoint and it works fine.
Glad to hear!
Thank you so much for this!
You're so welcome!
Thank you for this valuable training video. It was extremely helpful and easy to follow.
Great to hear it was helpful and easy to follow. Thanks!
Thank you for the content! Very helpful!
Glad it was helpful!
This is great thanks, helped me further streamline our processes and reduce email traffic in our business.
Glad it helped!
Thank you, that was so clear and I have been able to successfully set this up.
You're very welcome Julie! Glad it helped!
Thank you, so clear and helpful :)
Glad it was helpful!
You are truly amazing. Save my day❤
I'm so happy I could help!
Just fantastic - thanks April, life saver :-)
Glad I could help!
SO. HELPFUL. THANK YOU!!
You're welcome!
Thanks for your kind sharing - Perfect
My pleasure!
Thank you for help it worked for my department.
I'm glad it helped!
I love you
Thank you so much ♥
You're awesome!
Thank you very much. You saved my soul and my job. lol
Greetings from Brazil ;)
Wow I saved a soul and a job! That's a good day! Glad I could help :)
great work, thank you very much
Glad you liked it!
Thank you! I got it to work!!!
Awesome! You're very welcome
Thank you so much for your video, I solved my problem with your suggestion.
That's great, glad it worked!
Thank you April for this very helpful video
I wonder how you managed to display the document in columns in micsosoft list?
This video saved so much work for me! Thank you so much! Do you have a video that shows how to import more than one attachment? Thank you again!
Thank you for the tuto
You're welcome 😊
Dear April
you know, this is a lake of desert for me !!!!
Thanks greatly !!
You're welcome 😊
Hi April, thanks for this very informative video.
I have a form which has TWO fields for adding attachments (the first is to add an XLS expense claim form, the second is to add the receipts saved as a PDF doc).
I've followed your video but created two separate flows (Parse JSON, Get file contents using path and Add attachment). For both i've used the "first(body('Parse_JSON'))?['name'] expression" as each of these two fields only allows the uploading of 1 attachment each.
The files are correctly saved in their respective folders on OneDrive (Question and Question 2).
Question's file format is XXXX.XLS (e.g. Expenses_BOB.xls),
Question 2 file format is XXXX.PDF (e.g. Receipts_BOB.pdf)
The problem i am having is the second one is failing (at Get file contents using path).
The raw input is:
"host": {
"connectionReferenceName": "shared_onedriveforbusiness",
"operationId": "GetFileContentByPath"
},
"parameters": {
"path": "/Apps/Microsoft Forms/Expense Claim Form/Question 2/Expenses_BOB.xls",
"inferContentType": true
It is failing with a 404 Status, The resource could not be found.
Looking at the path in the second "Get file contents using path" it is referencing the file from the first "Get file contents using path" (Expenses_BOB.xls instead of Receipts_BOB.pdf)
How do I address that?
Many thanks in advance, Graeme
Thank you for this informative video ! I only have a question regarding the SharePoint list column of the attachment and what type is it ?
Great tutorial. Much appreciated. Do you know if the attachments can be saved in designated folders on MS Teams ?
Hey April, thank you so much for your videos, they are always so helpful and well structured!
Do you perhaps have any idea on how to achieve something similiar with external users?
Hmmm so unfortunately attachments in Forms is only supported for internal users right now and I'm not aware of any work-around for that. You can share a SHarePoint library to external users though so one way you could handle it is to share a library externally and provide a link to that library in the form and instruct them to go there to upload the attachments.
April, Thank you for the how-to. I follow your guide as exactly as I can tell however, I am running into a problem. When there is no attachment the flow fails.
Hi April, thank you so much for this video. Question- how did you create the expression to include the parse json? I keep getting an error message that.
April, amazing video. Thank you so much! One thing I figured out - and I know this was at the very end when you were trying to finish up so there was not a lot of time spent on it: You show two "Apply to each" boxes when grabbing multiple files, but I could only get it to work when I had ONE "Apply to each" action with both the "Get file Content using path" & the "Add attachment" in the same "Apply to each" action 'box.' Thanks again!!
I was having same issue. Thanks for posting as this was driving me crazy! Works now once I put them in the same Apply to each action.
This worked! Thank you
This was really helpful! I am having trouble trying to get the attachment to pop up using a group form and Sharepoint Library. Any ideas on what I should place in the file content area?
The video was very helpfull to me. As you mentioned if the attachment is more than 1 we should not use first(body) expression, so what would be expression for 3 attachment or >3
Hi April, thank you for the super useful video. Could you let me know how I can move these attachments to a SharePoint folder? I can't seem to add the folder location in the "Create Item" step on Automate
thank you so much I have been trying this for my automation for almost 2 days. it isn't working. With your guidance, I can successfully automate for the first time.
Hi, this is super helpful. Quick question: My flow works great when I upload a file to my form, but it fails at the Parse JSON step if there was no file uploaded. Is there a way to edit the parse JSON step so that it skips if there is no form file upload? Thanks!
Hi April, I use this video all the time for my Flows that have attachments - do you perhaps have an adjustment for when there is not attachment as sometimes we do no have a document required as evidence for the Flow. Warm regards
HI April, 1st, thank you for making these instructional videos. Very good! I'm having an issue with my file upload. I'd like it to show up in the list, but everytime I try to copy the JSON code and place it in the parse sample box it says there are errors. I've tried viewing and following different videos and same issue appears. Any suggestions or thoughts?
Hi April,
Thanks so much for this training material!
It's so clear to follow with your explaination. But I have a question here when I have one question in Form to ask user to upload attachments, while ppl can upload photos or videos. And I have created the flow per what you have mentioned in the video, but I could only open the photos in SharePoint when the user upload both photo and video in the same Form. And I can open the video when the user only upload video in that Form.
If there is anything I have to edit in the flow in order to solve this issue? Thanks so much!
Great video! It's very close to what I've been searching for. What would need to be added to this process to have the MS Form attachments (for a group form) be added to a document library according to the characters contained in the file attachment name? Example, files that contain the word "blue" are placed in the document library folder titled "Blue." Really hope you're able to help with this. Thanks!
Thanks a lot
Happy to help
Hi April, Thanks a lot for this great tutorial. I got stuck with the first function in get file content using path, what I have shown is differnt than what you had on the screen in the first function it's first(item()['name']) and even when following the remaining steps, not working
Hello April,
Thank you for clearly explained the steps.I do have a form with attachment that i am looking to collect the data in List, but when i create the item and plugged the site address, the list name cannot be found.I uploaded the files to One drive and can see the file in the Team folder that i created.What do you suggest me to do in that case ? Thank you.
Wow thank you so much April. Such a helpful video. I am wondering if you can help me. I have gone through the steps & I am struggling with the Parse JSON section. It says my schema is invalid. When copying the field in my Run History. All of my answers are situated in ''Body'' and are not individual like seen in your video. Does this make a difference to my flow going forward?
Thank you for your video, really helped! If I'd like to take this one step further and have the image that was uploaded from forms show in an approval before I add it to SharePoint (if approved), how would you go towards accomplish this? Thanks again.
Hi April, this worked for attaching my first attachment. Although I followed the same exact steps again for my 2nd attachment and am getting the error that the file does not exist. Is it a different expression to be used for the 2nd attachment?
Hi April, great video, thank you. Do you have any idea how to get round the fact that Microsoft Forms automatically adds '_anonymous' or the submitter's name to the end of the filename when uploaded? It's driving me insane!!!!! :)
Thanks for sharing..
You're welcome! Thanks for watching!
Is there a step that can be shared for how you would do automatic maintenance on the original location of the documents uploaded. In your example you're taking from the original one drive location and copying them to the list. Works so well! But we still have a lot of files that will just sit in the original location. Thinking it would be a good idea to keep that trimmed down since already found in the list.
Hi April, thanks for this video, can we get forms last response in a excel file and send it as email attachment to a set of people by power automate?
Hi
That is really nice useful
One quick question can we control by file size and type
e. g. If same emails logic have different type and size of files and we need only files size over 4 KB and type as HTML.
Can we config as addition to same scenario of yours
I have my flow set up just like your vid, but get an error 'Get file content using path' failed - The resource could not be found. The attachment is in the proper SharePoint folder. On the inputs of Get file content using path action, the file path = /Apps/Microsoft Forms/file name test.docx What am I missing? Any hints would be gladly taken!
This is really helpful, the only thing I have noticed is that when the image is saving into a folder it is then creating a new folder of the image name which is empty. What would be causing this?
Thanks for your help, this was a great video :)
I have come across another issue I cant seem to see you mentioned it in the video
I have a form that allows the person submitting it to upload up to 8 images however when submitted the list only shows one attachment is there a way to make the list show all the images that that were uploaded
edit: I have re watched and found it thanks again great stuff
thank you very much for your video! I have a question. I have a form where the user can upload 1 attachment or 3 attachments. Unfortunately the flow does not work in this case, I have this error: "The execution of the 'Apply_to_all' action of the model failed. The result of evaluating the expression 'foreach' '@outputs (' compose_output_ buffer ')' is of type 'Null'. The result must be a valid array". How can I do? thank you
Thank you. I’m having issues in pasting the code in json expression. Is there a reason for it? It doesn’t let me paste the code. Just comes up an empty cell.
Hi April, I have been using this video for some really important Flows in our business but in the past few days I have received an error when trying to open the document in the Sharepoint List. I have followed your steps implicitly and it works if there is one document but when I try multiple documents I cannot open the document - any idea what could be wrong?
Hi @april dunnam, this is a great help on my task!
i have a question though, is it possible to not include my name in the file when it is uploaded in my onedrive and the list?
other users might think that i'm narcissistic that every file that's being shown in the list has my name on it. :D
Can you do a tutorial on how to convert a file within a sharepoint document library to a PDF? Most of what I've seen you have to be specific about what folder the PDF goes to. But, what if I want an excel or word doc converted (additional copy) to a PDF in the same folder that the file already lives? Thanks April you rock!
I have everything working up to the "Get File Content" section where it grabs the file name. Even though the file exists, it keeps advising that the fild id is not valid. Any thoughts?
Hi April
Thank you April for sharing. It's quite useful. Any idea on how to check file “magic number”; the word value $5A4D (“MZ or “ZM” in ASCII) of the file before upload to prevent .exe.? Is it possible in Power Platform ? From JSON Binary not able to identify this. What's your view, suggestion on this? Thanks
Great video and good explanation about JSON. But an easier way to grab the file is instead of using "Get file content using path" is to use "Get file content" and use "id" from Parse JSON. And you already have the "name" in Parse JSON. No need for an expression when you Add attachement.
Joakim, thanks sooooo much for posting this. In my environment I could NOT get the get file content using path method to work but your proposed change fixed it right up for me and it's working now. you rock!
for anyone who has issue finding "file content" , this is the best approach. when using "Get file content" , don't put the path (you will have issues otherwise), just use JSON id alone; first(body('Parse_JSON'))?['id'] and then when adding attachment , as Joakim mentioned, you just need to add "name" as it will be available in the dynamic content list under "Parse JSON"
What parameters do you have to have in the List in order for Excel files to be extracted from a form? I am really struggling to make this work. I will try your tip and check if it would work.
I was wondering if you could assist me to create a power automate flow that would create some folders and move some files into this folder every time a new folder is created. I want to create the folder based on the windows dialog box from a html5 form, and I do have some checks list that I want to select to control how many files will be moving into the new folders. Do you think you could help me?
Hello April, I would like to ask for your help because I have a form where attachment is not a mandatory field. How should I change the process in order to save the other data to my list? Thanks in advance
Thank you so much for making the video. This is very useful. I’ve been trying to figure out how to do the below task and need some help please:
I’ve created a form with different branches. If user choose type A, then type A questions pop up; if type B, then type B related questions.
Both have two questions asking them to attach files.
My desire outcome is show their responses as a PDF with a link in the PDF to open the file they attached. And post the response PDF on sharepoint (Microsoft list)
Is it doable?
Hi April, what column type is your Attachments column in the list?