Get Url from image in microsoft forms with flow

%3CLINGO-SUB%20id%3D%22lingo-sub-1198607%22%20slang%3D%22en-US%22%3EGet%20Url%20from%20image%20in%20microsoft%20forms%20with%20flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1198607%22%20slang%3D%22en-US%22%3EWhen%20using%20microsoft%20forms%20with%20an%20image%2C%20a%20URL%20for%20Onedrive%20is%20automatically%20generated.%20This%20URL%20comes%20within%20an%20arrey%20that%20has%20this%20format%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%5B%7B%22name%22%3A%22Digital%20Manufecturing_brafmann.PNG%22%2C%22link%22%3A%22URL%22%2C%22id%22%3A%2201AGRA64XZOIJZNMJD25GIC6TM23OQ3IPQ%22%2C%22type%22%3Anull%2C%22size%22%3A32777%2C%22referenceId%22%3A%2201AGRA64T6LD7CKZ6ECJALCIUFMOYGFRZV%22%2C%22driveId%22%3A%22b!W43e_F7eHkef12oFXfJbuOAOtAtdhZhFm-pRnDH3GKX8auJaS5YlRYSvbEbN_6p8%22%2C%22status%22%3A1%2C%22uploadSessionUrl%22%3Anull%7D%5D%3CBR%20%2F%3E%3CBR%20%2F%3EHow%20can%20I%20get%20just%20the%20URL%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1198607%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Flow%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1208864%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20Url%20from%20image%20in%20microsoft%20forms%20with%20flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1208864%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F569681%22%20target%3D%22_blank%22%3E%40FlowDev%3C%2FA%3E%26nbsp%3Byou%20need%20to%20add%20a%20Parse%20JSON%20action%20to%20your%20flow.%20The%20easiest%20way%20to%20get%20the%20schema%20is%20to%20run%20your%20flow%20as%20it%20is%20and%20copy%20the%20JSON%20code%20for%20the%20image%20(in%20my%20example%20I'm%20uploading%20the%20details%20from%20the%20form%20to%20Excel)%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%220-copyCode.png%22%20style%3D%22width%3A%20561px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F175040iC79A075F717FF4CA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%220-copyCode.png%22%20alt%3D%220-copyCode.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20your%20flow%20add%20the%20Parse%20JSON%20action%2C%20in%20the%20content%20box%20select%20Image%20from%20the%20dynamic%20content%2C%20click%20Generate%20from%20Sample%20and%20paste%20in%20the%20code%20you%20copied%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%221-parseJSON.png%22%20style%3D%22width%3A%20582px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F175038iF85EB56F7FE51ED1%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%221-parseJSON.png%22%20alt%3D%221-parseJSON.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20will%20then%20have%20an%20apply%20to%20each%20where%20the%20output%20box%20is%20Body%20(from%20the%20Parse%20JSON%20action)%2C%20and%20you%20can%20select%20link%20from%20the%20Parse%20JSON%20section%20of%20the%20dynamic%20content%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%222-addRow.png%22%20style%3D%22width%3A%20742px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F175039i6DA337E243DF2E2F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%222-addRow.png%22%20alt%3D%222-addRow.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20result%20in%20the%20spreadsheet%20will%20be%20just%20the%20url%20without%20all%20the%20other%20stuff%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%223-excelResult.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F175036iDE3EAEFE8FBDC23A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%223-excelResult.png%22%20alt%3D%223-excelResult.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERob%3CBR%20%2F%3ELos%20Gallardos%3CBR%20%2F%3EMicrosoft%20Power%20Automate%20Community%20Super%20User%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1571644%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20Url%20from%20image%20in%20microsoft%20forms%20with%20flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1571644%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F174092%22%20target%3D%22_blank%22%3E%40Rob%20Elliott%3C%2FA%3E%26nbsp%3BI%20have%20successfully%20setup%20the%20Parse%20JSON%20for%20extracting%20image%20link%2C%20however%2C%20I%20am%20pulling%20the%20image%20from%20an%20optional%20field%20of%20a%20form%20and%20the%20flow%20fails%20if%20there%20is%20no%20image%20uploaded%20in%20the%20form.%20How%20can%20I%20adjust%20the%20parse%20to%20allow%20for%20null%2Fno%20images%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Visitor
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?

 

3 Replies

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):

 

0-copyCode.png

 

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:

 

1-parseJSON.png

 

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:

 

2-addRow.png

 

The result in the spreadsheet will be just the url without all the other stuff:

 

3-excelResult.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliott I have successfully setup the Parse JSON for extracting image link, however, I am pulling the image from an optional field of a form and the flow fails if there is no image uploaded in the form. How can I adjust the parse to allow for null/no images?

Thanks a lot @RobElliott I too had a issue in the similar context and your solution worked very well. Thank you.