Invoke Code activity issue in converting image format

I am trying to convert the image to base64 format using Invoke code activity. But i couldn’t do it
My code is
Static void Main(String args)
byte imageArray = System.IO.File.ReadAllBytes(@“C:\Users\DELL\Downloads\captcha (1).png”);
String base64ImageRepresentation = Convert.ToBase64String(imageArray);
Please help me to resolve this issue.

Why do you want to use Invoke Code Activity.
You can do with Simple Assign Activities.

create a variable imageArray (datatype: byte) and base64ImageRepresentation (datatype: String)

Assign Activity, imageArray = System.IO.File.ReadAllBytes(PATH_OF_IMAGE)
Assing Activity, base64ImageRepresentation = Convert.ToBase64String(imageArray)

If you get error - please add missing namespaces.

Karthik Byggari


No function or procedure can be used inside invoke code activity. Just leave two line body of your main method.

1 Like

It works :+1:
many thanks