Attachments in Lists via Forms

Brass Contributor

I have a Microsoft Form which has an option to attach a PDF. I also have a Flow which populates a Sharepoint List with the answers from the Form.

 

Is there a way to have any of the PDFs (attached to the Form), to also populate in the List?

2 Replies

@SeanS yes in your flow you can get it to add the PDF as an attachment to the list item in SharePoint via your OneDrive.

 

The images and instructions below are from a live applications support ticketing system I built at my company.

 

After your  Forms "When a new response is submitted" and the "Get response details" action add a Parse JSON action. In the Content field, from the dynamic content select the question which ypou've used in your form for the attachment. For the schema field copy and paste the code I've added below the image:

1-Flow.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"
        ]
    }
}

 

Next, add a Get file content using path action. Forms will save the file to your One drive in the following folder /apps/Microsoft Forms/{the name of your form}/Question 

After Question add a / then the following expression in the dynamic content Expression tab: 

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

 

2-Flow.png

 

Add the SharePoint Create item action. After that, to make sure the Create item action has time to complete I put in a short delay action:

 

3-Flow.png

 

Next, add an Apply to each. From the dynamic content select Body from the Parse JSON section.

 

Next, add a SharePoint Add attachment action:

For the ID field select ID from the Create item section of the dynamic content.

For the Filename field select name from the Parse JSON section of the dynamic content.

For the File content field select File content from the Get file content using path section of the dynamic content.

 

4-Flow.png

 

I've then got other actions further down but those are the steps for attaching the file to the SharePoint list item. Hope it helps.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliott 

I actually found this post yesterday and got it working perfect. Thanks so much for your help.

 

Sean