Attachments in Lists via Forms

%3CLINGO-SUB%20id%3D%22lingo-sub-1797093%22%20slang%3D%22en-US%22%3EAttachments%20in%20Lists%20via%20Forms%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1797093%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20Microsoft%20Form%20which%20has%20an%20option%20to%20attach%20a%20PDF.%20I%20also%20have%20a%20Flow%20which%20populates%20a%20Sharepoint%20List%20with%20the%20answers%20from%20the%20Form.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20have%20any%20of%20the%20PDFs%20(attached%20to%20the%20Form)%2C%20to%20also%20populate%20in%20the%20List%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1797093%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFlow%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EForms%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ELists%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
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