Hi Sener Gazi
Thanks for reaching out on Microsoft Q&A!
The reason your attachment isn't added as expected is due to the fact binaries in Logic Apps are decoded in a JSON format. Therefor your binary isn't just BASE64, but looks somewhat like below:
{
"$content": "dGVzdA==",
"$content-type": "text/plain"
}
Also see a sample from my Logic App test lab as well:
So to get to your BASE64 that needs to be added in the 'ContentBytes' part of the attachments you should not refer to the attachment contents from the selection menu, but point to the '$content' using the code below:
body('Get_attachment_content')['$content']
Next to that you're now also able to add a 'ContentType' part to the attachment object using:
body('Get_attachment_content')['$content-type']
Your object will then look somewhat like below:
{
"Name": "@{items('For_each_2')?['DisplayName']}",
"ContentBytes": "@{body('Get_attachment_content')['$content']}",
"ContentType": "@{body('Get_attachment_content')['$content-type']}"
}
Resulting in this output:
Please let me know if my answer was helpful by clicking 'Accept answer'. Feel free to drop additional queries in the comments below!
Kind regards,
Sonny