We are trying to send emails with attachments using the MS Graph sendMail API.
We're seeing an issue where the document is not being converted to Base64, see screenshot below.
Is the issue that we're starting with a json and converting to dictionary? This was done because if we define the dictionary directly, the key "@odata.type" is not recognised properly because of the period.
Thanks!
Discussion posts and replies are publicly visible
Use the following code in your "attachments" attribute
"attachments": { if( a!isNullOrEmpty(ri!attached), {}, a!forEach( items: ri!attached, expression: { "@odata.type": "#microsoft.graph.fileAttachment", "name": concat( document(fv!item, "name"), ".", document(fv!item, "extension") ), "contentType": concat( "application/", document(fv!item, "extension") ), "contentBytes": fv!item } ) ) }
Amazing that worked with one small change, line 18 should be "contentBytes": toDocument(fv!item)
Thank you v much!