SOLVED

How do i add attachments from Microsoft Forms onto Sharepoint List

Copper Contributor

Hello. 

Trust everyone is safe and well :smile:.

I have been trying to follow the video on how to add attachments from forms to sharepoint list but i am not doing something right as i keep getting this error. 

 

Any help will be welcome. Thank you

 

Sur76_0-1625394437858.png

 

This is the make up of my flow

 

Sur76_1-1625394496140.png

 

Sur76_2-1625394527721.png

 

On the Parse Json - i am not sure what to add here - i copied and pasted the schema provided

 

Sur76_3-1625394578586.png

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

Sur76_4-1625394609844.png

 

 

19 Replies
best response confirmed by Sur76 (Copper Contributor)
Solution
Don't use a template to build this flow which will put in that first apply to each which is not needed and usually causes problems. Build it from new going straight from When a new response is submitted to get response details.

Thank you so much. I am going try it now. It worked like a bomb.... You are freaking super awesome .... Thank you soooooo much

@Sur76 So what did you do in the end, exactly? In my Get Response Details it never shows anything about the attachement from the Form? 

@GBeulen no it won't, the steps you need to add a file uploaded to a Microsoft Forms form to an attachment in a SharePoint list are as shown below.

 

Your trigger is the Forms "when a new reponse is submitted". The first action as always is the Forms "get response details":

1-Flow.png

 

You now need to add a "Parse JSON action". In the content field select the question from your form where you asked the user to upload the file.

The schema field will work with the following:

 

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

 

 

2-Flow.png

 

The file is always saved to your OneDrive in the 

/Apps/Microsoft Forms/YourForm/Question folder so in a OneDrive "get file content using path" action add that and follow it with the following expression:

first(body('Parse_JSON'))?['name']
 

3-Flow.png

 

Next, create an item in your SharePoint list:

 

4-Flow.png

 

Next, add an "apply to each" action and in the first field select Body from the Parse JSON section of the dynamic content box.

 

Finally, inside the apply to each add a SharePoint "add attachment" action. In the Id field select ID from the create item section of the dynamic content. In the File name field select name from the Parse JSON section of the dynamic content box. In the File content field select File content from the "get file content using path" section of the dynamic content.

 

 

5-Flow.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliott 

You are a genius, that has just solved an issue for a beginner, thank you

Hey Rob, when I follow this I get a failure notification that says the schema validation failed. Do you know what this error could mean? I copied your schema exactly.

@RobElliott , why do I still get error message even though i have change to my path as below

 

{
  "status": 404,
  "message": "The resource could not be found.",
  "source": "api.connectorp.svc.ms"
}
 
zalikha_johar_3-1684895971322.png

 


 

this is my path (group sharepoint) 

 

zalikha_johar_1-1684895835699.png

.

even i have tried so many different method including yours, stil get error message.

 

And this is my connection. is it because of this?

zalikha_johar_2-1684895902858.png

Please advise what needs to be done.

 

Thank you in advance.

Hi Rob,

I followed the steps as you mentioned. however, I get an error "A potentially dangerous Request.Path value was detected from the client (?)." this error heppens on the "Get file content using path" step, where my file path is my sharepoint folder on the company domani. any idea how to resolve this? thanks.

@RobElliott 

@babak1990 

 

Use build-in folder selection should solve your issue.

DingkunXie_0-1687924286042.png

 

@RobElliott 

 

Thanks for your guidance!

I have followed your suggestion to set the flow and it can transfer the attachments to SharePoint List successfully. But when I try to attach one photo and one video in the form and submitted, I can only open the photo but not the video in the SharePoint list. And when I attach only the video in the form, it is ok to open the video. 

Just wonder if there is any extra step I have to build in in my flow in order to solve this issue?

 

Thanks!

 

Regards,

Ann

@RobElliott  i am unable to use picker for selecting one drive folder.

@rlehrawaaca why not? You can just type the folder path in the field:

 

folderPicker.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP (and classic 1967 Morris Traveller driver)

This was great, but what if you want to have the option to include or not include the attachment from the Form to List. I mention this because when I used your workflow and don't attach something in the MS Form, then I get an error.

What I do is to go to settings for the actions that relate to the optional file upload, go to settings and select Configure Run After and select Failed as well as is successful. The following images are from our IT Support Ticketing System where uploading a file is not mandatory.

1-Flow.png

 

2-Flow.png

 

So even if the individual actions actions relating to the  file upload fail the flow continues to run and will be shown in the run history as succeeded.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)

 

 

I can't find the UploadedFile Action. ANy help? :|

@rolaogomes That;'s a SharePoint get file content using path action which I renamed.

@Rob_Elliott so you have 2 actions for get file?

@rolaogomes yes because they're getting different files; one is for the uploaded file and the other is to get the logo which goes into the confirmation email we send.

 

 

@RobElliott 

 

Could you assist me in resolving the issue with my flow? I have a flow set up where a Microsoft Form submission creates a list in Microsoft List with attachments. While I'm able to see the attachments in the Microsoft List, I encounter an error when attempting to open them.

Bbhuva_0-1715585446781.png

 

Bbhuva_2-1715585648650.png

Bbhuva_3-1715585711688.png

 

 

Bbhuva_4-1715585744367.png

Thanks in advance.

Bhavesh

 

1 best response

Accepted Solutions
best response confirmed by Sur76 (Copper Contributor)
Solution
Don't use a template to build this flow which will put in that first apply to each which is not needed and usually causes problems. Build it from new going straight from When a new response is submitted to get response details.

View solution in original post