cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sudosaurus
Post Prodigy
Post Prodigy

MS Forms to SharePoint list doesn't like image attachments

Hello,

 

In my flow below, I am creating a SharePoint list item when a new response is submitted from MS Forms.

 

sudosaurus_0-1649411464991.png

sudosaurus_1-1649411494736.png
Next I am using this JSON schema to parse the attachments from MS Forms before being able to add them to my SharePoint list item. This is working for files such as .txt, .doc, .xls but not working for .jpg, .png - error at bottom of post.

 

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

sudosaurus_2-1649411515773.png

 

When I run the flow, I get thie error on the JSON action:

[
  {
    "message": "Invalid type. Expected Object but got Array.",
    "lineNumber": 0,
    "linePosition": 0,
    "path": "",
    "schemaId": "#",
    "errorType": "type",
    "childErrors": []
  }
]

As mentioned above, this is only occuring for image attachments.

4 REPLIES 4
v-xiaochen-msft
Community Support
Community Support

Hi @sudosaurus ,

 

The error shows that the output of your form's attachments is an array. But the schema of the 'parse Json' expects an object.

 

Please copy the outputs of your attachments and paset it here.

vxiaochenmsft_0-1649651779777.png

 

Best Regards,

Wearsky

 

sudosaurus
Post Prodigy
Post Prodigy

Hi @v-xiaochen-msft 

 

Here's my upload output:

[{"name":"710Cr6Lot5L._AC_SL1500__Chris Cundy.jpg","link":"https://ondomain-my.sharepoint.com/personal/powerplatform_livewest_co_uk/Documents/Apps/Microsoft%20Forms/Application%20for%20a%20LiveWest%20Sponsored%20CIH%20Vocationa/Question/710Cr6Lot5L._AC_SL1500__Chris%20Cundy.jpg","id":"01UAWTK6PSUTPYNORUR5AKUFOY6NQMTMWQ","type":null,"size":115366,"referenceId":"01UAWTK6IANOEWSKQWSRHLL4Z3WG72JDM6","driveId":"b!lgB84gaIYEKwmDafJaNZ6teW0qwZWA1FkhEvTL8_nhTXJmYE0_v-RYpJfalqhfI8","status":1,"uploadSessionUrl":null}]

 

v-xiaochen-msft
Community Support
Community Support

Hi @sudosaurus ,

 

If you copy the output and paste it to the 'Parse Json' action ,will it work?

 

Best Regards,

Wearsky

sudosaurus
Post Prodigy
Post Prodigy

@v-xiaochen-msft 

Well it's worked for the Parse JSON step however on the next step (Get file content - OneDrive for Business),
I am getting this error:

sudosaurus_0-1649692226540.png

 

Unable to process template language expressions in action 'Get_file_content_of_MS_Forms_attachments' inputs at line '0' and column '0': 'The template language expression 'body('Parse_JSON_from_MS_Forms_file_upload_attachments')?['items']?['properties']?['id']' cannot be evaluated because property 'items' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,453)