Sending images to azure computervision ocr

I have never worked with this, what I’m trying to do is first select all the attachements, if it’s a pdf extract the images and the save them to a specific folder, the same for regular images in the attachements. Then I want to send all the images to azure and write the result to a jsonsfile in the same directory as the image.

This is what I have so far, I can save the images (the normal onces as the extracted ones) I can get all the files, then I’m trying to loop the files create an image of it and send it to azure, for some of them it works, other give me an exception saying the scraping returns an empty string.
I’m also not sure how to create a jsonfile, I can convert the result into a datatable and then into a jsonstring, but if I would simply write it to a file wouldn’t that give me .txt extension?

To make it more easy, I included the .xaml file I’m using to sent the images to azureSentImagesToAzure.xaml (7.3 KB)