cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Filter Base64 String from SharePoint list attachments

The ultimate goal here is to append SharePoint list attachments to an existing HTML as Base64 that I created from within an "Initialize variable" set to string. The attachments would display as an image at the bottom of the HTML which I then convert to a PDF as one attachment. 

 

I found by using Sunay Vaishnav solution for attaching list items to an email that I was able to figure out, but I could not attach both the HTML and attachments. There might be an easy fix for that using json if you can answer that one also.

  {
    "Name": "Test@{triggerBody()?['Item_x0020_Number']}.pdf",
    "ContentBytes": "@{body('HTTP')}"
  }

@{variables('attachmentArray')}

 

This solution from Sunay, I noticed provides Base64 which I think would work by appending it to the HTML somehow. Being that there is an unknown amount of list attachments and the output of the variable is something like the following ('[ { "Name": "image.jpg", "ContentBytes": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCw) I don't know how I can filter that, then add (src="data:image/jpeg;base64,) to the beginning to append to the HTML.

 

The action Append to array variable value is set to the following.

{
  "Name": @{items('Apply_to_each')?['DisplayName']},
  "ContentBytes": @{body('Get_attachment_content')['$content']}
}

 

I hope that makes sense. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Filter Base64 String from SharePoint list attachments

@msmith 

 

If you jsut need to append text then once again use expression

 

concat('your text', dynamiccontentattachmentcontet)

 

This will append the text

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

View solution in original post

5 REPLIES 5
Highlighted
Dual Super User
Dual Super User

Re: Filter Base64 String from SharePoint list attachments

Hi @msmith 

 

There is an expression function called base64

 

try that

 

base64(dynamicattachmentcontent)

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Highlighted
Helper V
Helper V

Re: Filter Base64 String from SharePoint list attachments

Sorry RezaDorrani, where would I put that expression?

Highlighted
Dual Super User
Dual Super User

Re: Filter Base64 String from SharePoint list attachments

@msmith 

 

In Array Variable setting

 

Capture.PNG

 

the yellow portion replac eit with expression

 

base64(dynamiccontentattachvalue)

 

dynamiccontentattachvalue - you will have to replace this text in the expression with the dynamic content value for attachment content

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

 

 

Highlighted
Helper V
Helper V

Re: Filter Base64 String from SharePoint list attachments

I understand what you mean by putting it in the expression, but it is not working for me. Also, when looking at my question, the red font shows the Base64 string. I am not understanding how entering in base64(dynamiccontentattachvalue) will give me the option to append a variable that contains HTML. How will I get that Base64 code in there? I saw a similar post out there with this expression and it was not explained.

Highlighted
Dual Super User
Dual Super User

Re: Filter Base64 String from SharePoint list attachments

@msmith 

 

If you jsut need to append text then once again use expression

 

concat('your text', dynamiccontentattachmentcontet)

 

This will append the text

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

View solution in original post

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (8,219)