逻辑应用程序-发送带有附件的电子邮件-“无法解析模板语言表达式‘base64(‘triggerBody()?[‘contentBytes’]’)’:”

问题描述

正在使用逻辑应用程序中的附件在 http 触发器上发送电子邮件。提供 json 输入如下

{
    "properties": {
        "bcc": {
            "type": "string"
        },"body": {
            "type": "string"
        },"cc": {
            "type": "string"
        },"subject": {
            "type": "string"
        },"to": {
            "type": "string"
        },"attachments":{
            "name":{
                "type":"string"
            },"ContentBytes":{
                "type":"string"
            }
        },"type":"object"
    },"type": "object"
}

以 base64 字符串格式传递附件。 但是在为内容变量配置附件时出错

无法解析模板语言表达式 'base64('triggerBody()?['contentBytes']')':预期的令牌 'RightParenthesis' 和实际的 'Identifier'。".'

enter image description here

解决方法

您需要点击 Add dynamic content 并使用以下表达式:

base64(triggerBody()?['attachments']?['ContentBytes'])

enter image description here