Logic App Send Email V2动态内容不显示问题咨询与修复
问题解答
1. 问题产生的原因
从你提供的代码来看,核心问题是动态内容的引用路径完全错误:
- 你混淆了Parse JSON的Schema结构和实际返回的数据结构,把Schema里的
properties、type等定义字段当成了实际业务数据的层级去引用,比如body('Parse_JSON')?['properties']?['value']?['type']?['type']?['type']这类路径,本质是在访问Schema的描述信息,不是真实的业务数据。 - 你用到的
body('Parse_JSON')?['d']在当前Parse JSON的Schema里根本不存在,自然取不到任何值。 - 当路径无效时,Logic Apps会返回空值或直接显示路径表达式,导致邮件正文无法正常展示预期内容。
2. 修复方式及是否为Bug
- 不需要手动编写复杂代码,完全可以通过拖放操作修复,这不是Logic Apps的Bug,是你对Parse JSON组件的使用逻辑和动态内容路径的理解出现了偏差。
- 修复的关键是先确保Parse JSON组件使用了对应真实API返回数据的正确Schema,之后就能在Send Email组件里直接拖放Parse JSON输出的合法字段,无需手动编写错误路径。
3. Parse JSON与Send Email的不一致问题分析
你当前使用的Parse JSON Schema是一个描述Schema规则的结构(多层嵌套的properties和type),而非实际业务数据的结构:
- 实际业务数据里的
value应该是包含业务字段的数组,但你现在的路径是去Schema里反复查找type层级,完全偏离了实际数据的位置。 - 你写的
body('Parse_JSON')?['d']在当前Schema里没有对应字段,拖拽后自然取不到值。
正确操作步骤:
- 从Logic Apps的运行历史中,复制Parse JSON组件上游API返回的真实输出数据。
- 将真实数据粘贴到Parse JSON组件的「使用示例负载生成Schema」功能中,生成匹配实际数据结构的正确Schema。
- 返回Send Email组件,重新从Parse JSON的动态内容列表里拖放
value数组中的appId等字段(如果是数组类型,可能需要用For each循环遍历后拼接内容)。
附你提供的代码片段(整理后)
Parse JSON输出(Send Email组件配置)
{"inputs": {"host": {"connection": {"name": "@parameters('$connections')['office365']['connectionId']"}},"method": "post","body": {"To": "allen.visser@gmail.com","Subject": "POSITIVE: REG APP EXP @{variables('displayName')} ","Body": "<p>appid : @{body('Parse_JSON')?['properties']?['value']?['type']?['type']?['type']?['items']?['type']?['properties']?['appId']}<br>\n<br>\n<br>\nappid : @{body('Parse_JSON')?['d']?['properties']?['value']?['items']?['properties']?['appId']}<br>\n</p>","Importance": "Normal"},"path": "/v2/Mail","authentication": "@parameters('$authentication')"}}
Parse JSON Body(另一个Send Email配置)
{"inputs": {"host": {"connection": {"name": "@parameters('$connections')['office365']['connectionId']"}},"method": "post","body": {"To": "allen.visser@vaxowave.com","Subject": "POSITIVE: REG APP EXP @{variables('displayName')} ","Body": "<p>appid : @{body('Parse_JSON')?['properties']?['value']?['type']?['type']?['type']?['items']?['type']?['properties']?['appId']}<br>\n<br>\n<br>\nappid : @{body('Parse_JSON')?['d']?['properties']?['value']?['items']?['properties']?['appId']}<br>\n</p>","Importance": "Normal"},"path": "/v2/Mail","authentication": "@parameters('$authentication')"}}
当前使用的Parse JSON Schema
{"properties": {"properties": {"properties": {"@@@odata.context": {"properties": {"type": {"items": {"type": "string"},"type": "array"}},"type": "object"},"@@@odata.nextLink": {"properties": {"type": {"items": {"type": "string"},"type": "array"}},"type": "object"},"value": {"properties": {"items": {"properties": {"properties": {"properties": {"appId": {"properties": {"type": {"items": {"type": "string"},"type": "array"}}},"type": "object"},"displayName": {"properties": {"type": {"items": {"type": "string"},"type": "array"}}},"type": "object"},"id": {"properties": {"type": {"items": {"type": "string"},"type": "array"}}},"type": "object"},"passwordCredentials": {"properties": {"items": {"properties": {"properties": {"properties": {"customKeyIdentifier": {"properties": {"type": {"items": {"type": "string"},"type": "array"}}},"type": "object"},"displayName": {"properties": {},"type": "object"},"endDateTime": {"properties": {"type": {"items": {"type": "string"},"type": "array"}}},"type": "object"},"hint": {"properties": {},"type": "object"},"keyId": {"properties": {"type": {"items": {"type": "string"},"type": "array"}}},"type": "object"},"secretText": {"properties": {},"type": "object"},"startDateTime": {"properties": {"type": {"items": {"type": "string"},"type": "array"}}},"type": "object"}}},"type": "object"},"required": {"items": {"type": "string"},"type": "array"},"type": {"type": "string"}}},"type": "object"},"type": {"type": "string"}}},"type": "object"}},"type": {"type": "string"}}},"type": "object"}
内容的提问来源于stack exchange,提问作者user21420008
相关产品推荐
相关产品推荐

