Hello,
In my flow below, I am creating a SharePoint list item when a new response is submitted from MS Forms.
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"
}
}
}
}
}
}
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.
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.
Best Regards,
Wearsky
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}]
Hi @sudosaurus ,
If you copy the output and paste it to the 'Parse Json' action ,will it work?
Best Regards,
Wearsky
@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:
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.'.