cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GrantC101
Helper I
Helper I

Convert JSON to Image

Hello Hoping to get some help

 

I have managed to get a Pen input to be saved as JSON in a SharePoint list.

I am now struggling to convert this into Image for use on a email and document.

I have had to use an existing SharePoint list and Power App from. I am unable to ask Power Apps and can only go off the information saved into the SharePoint item.

I am hoping I don't have to build something from scratch.

 

GrantC101_1-1612360726674.png

 

GrantC101_2-1612360746534.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @GrantC101 ,

 

Please try to delete the action in the flow or recreate a new flow.

I ran into the same problem initially and solved it after rebuilding a flow.

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

6 REPLIES 6
v-xiaochen-msft
Community Support
Community Support

Hi @GrantC101 ,

 

Could you tell me:

Have you stored many records with pictures in base64 format in the list?

  • Do you want to convert these base64 pictures into file format pictures?
  • After the conversion is completed, do you want to save the pictures to the sharepoint library or send the picture as an attachment by email?

 

If my assumptions are correct, the key is to build a flow.

I've made a test for your reference:

1\ This is my list ‘LIST69’

v-xiaochen-msft_0-1612428816451.png

 

 

2\ Build an instant flow. When flow runs, it will convert all base64 formatted pictures in the list into files.

v-xiaochen-msft_1-1612428816480.png

 

File Content: dataUriToBinary(items('Apply_to_each')?['Signature'])

 

3\ The result is as follows:

v-xiaochen-msft_2-1612428816483.png

 

v-xiaochen-msft_3-1612428816485.png

 

 

Best Regards,

Wearsky

If my post helps, then please consider Accept it as the solution to help others. Thanks.

GrantC101
Helper I
Helper I

Hello @v-xiaochen-msft 

 

I have not stored many records with pictures in base64 format in the list

I would like to be able to put the signatures into a email and that be it.

 

The SharePoint list just stores the JSON, and I would keep a record of the Emails

I was looking at creating a flow when a SharePoint Item is created and then attach the signature with the existing attachment array.

array.png

v-xiaochen-msft
Community Support
Community Support

Hi @GrantC101 ,

 

Could you tell me:

  • Do you want to send an email when an item is created? Does the email contain many attachments? Does the attachments come from the attachment column of the item?
  • In addition to the attachments in the Item, do you want to convert the base64 signature image to an image file and send it to the user as an attachment?
  • In other words, if an item has 5 attachments, do you want to send an email containing 6 attachments (5 attachments + 1 signature file) ?

 

If my assumptions are correct, please try the steps below:

1\ Build my flow

v-xiaochen-msft_0-1612495639164.png

 

v-xiaochen-msft_1-1612495639188.png

 

Value: {

  "Name": @{items('Apply_to_each')?['DisplayName']},

  "ContentBytes": @{body('Get_attachment_content')?['body']}

}

 

v-xiaochen-msft_2-1612495639199.png

 

Value: {

  "Name": "aa.png",

  "ContentBytes": @{dataUriToBinary(outputs('Get_item')?['body/Signature'])}

}

 

v-xiaochen-msft_3-1612495639202.png

 

 

2\ The result is as follows:

v-xiaochen-msft_4-1612495639211.png

 

 

Best Regards,

Wearsky

If my post helps, then please consider Accept it as the solution to help others. Thanks.

Hello @v-xiaochen-msft 

 

You have assumed correct this is exactly what I want wont to achieve.

 

I have created the same flow as you have shown but now getting an error;

 

Unable to process template language expressions in action 'Append_to_array_variable_2' inputs at line '1' and column '3074': 'The template language function 'dataUriToBinary' expects its parameter to be formatted as a valid data URI.

 

here is the flow;

 

New Flow.png

v-xiaochen-msft
Community Support
Community Support

Hi @GrantC101 ,

 

Please try to delete the action in the flow or recreate a new flow.

I ran into the same problem initially and solved it after rebuilding a flow.

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

Thank you @v-xiaochen-msft 

 

For some reason it worked when I rebuilt it

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (1,797)