Forum Discussion
FlowDev
Feb 27, 2020Copper Contributor
Get Url from image in microsoft forms with flow
When using microsoft forms with an image, a URL for Onedrive is automatically generated. This URL comes within an arrey that has this format:
[{"name":"Digital Manufecturing_brafmann.PNG","link":"URL","id":"01AGRA64XZOIJZNMJD25GIC6TM23OQ3IPQ","type":null,"size":32777,"referenceId":"01AGRA64T6LD7CKZ6ECJALCIUFMOYGFRZV","driveId":"b!W43e_F7eHkef12oFXfJbuOAOtAtdhZhFm-pRnDH3GKX8auJaS5YlRYSvbEbN_6p8","status":1,"uploadSessionUrl":null}]
How can I get just the URL?
[{"name":"Digital Manufecturing_brafmann.PNG","link":"URL","id":"01AGRA64XZOIJZNMJD25GIC6TM23OQ3IPQ","type":null,"size":32777,"referenceId":"01AGRA64T6LD7CKZ6ECJALCIUFMOYGFRZV","driveId":"b!W43e_F7eHkef12oFXfJbuOAOtAtdhZhFm-pRnDH3GKX8auJaS5YlRYSvbEbN_6p8","status":1,"uploadSessionUrl":null}]
How can I get just the URL?
- RudyStevikCopper Contributorhello,
can anyone please copy-paste here the scheme?
The task is quite similar to what TS had. I've been struggling all day long with editing the scheme, but it keeps returning the whole array ...
TIA - RobElliottSilver Contributor
Hi FlowDev you need to add a Parse JSON action to your flow. The easiest way to get the schema is to run your flow as it is and copy the JSON code for the image (in my example I'm uploading the details from the form to Excel):
In your flow add the Parse JSON action, in the content box select Image from the dynamic content, click Generate from Sample and paste in the code you copied:
You will then have an apply to each where the output box is Body (from the Parse JSON action), and you can select link from the Parse JSON section of the dynamic content:
The result in the spreadsheet will be just the url without all the other stuff:
Rob
Los Gallardos
Microsoft Power Automate Community Super User- GautamIyerCopper Contributor
RobElliott Hi Rob, just to follow up on this, my image field is an optional field, and when there is no image attached to the share point entry, then my parse JSON fails, with the error that the data type cannot be ‘Null’ and a string is expected. It would be really helpful if you can help me with the same!
- GautamIyerCopper ContributorThis is the error I keep getting.
"message": "Invalid type. Expected String but got Null.",
"lineNumber": 0,
"linePosition": 0,
"path": "d.Logo",
"schemaId": "#/properties/d/properties/Logo",
"errorType": "type",
"childErrors": []
}
]
- MateoCarrenoCopper Contributor
RobElliott From where can I get the JSON code for the image?
- Sudeepa47Copper Contributor
Thanks a lot RobElliott I too had a issue in the similar context and your solution worked very well. Thank you.