cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
msmith
Level 8

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
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
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.

msmith
Level 8

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.

 

 

 

msmith
Level 8

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.

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 296 members 3,009 guests
Please welcome our newest community members: