You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Power Automate中JSON邮件Body字符串添加换行符失效问题求助

Power Automate中SharePoint邮件Body换行问题解决方法

核心原因

SharePoint通过HTTP请求接收的邮件Body通常解析HTML格式的换行,普通的\n或\r转义字符会被当成纯文本处理,无法生效。

可行解决方案

  • 直接使用HTML换行标签<br>:在需要换行的位置插入<br>,构造JSON字符串示例:
    {
      "Body": "表单提交人:@{outputs('Get_response_details')?['body/responder']}<br>提交时间:@{outputs('Get_response_details')?['body/submitDate']}<br>反馈内容:@{outputs('Get_response_details')?['body/r123456']}"
    }
    
  • 用表达式生成换行并配合<pre>标签:通过decodeUriComponent('%0A')生成换行符,再用<pre>标签保留格式,示例:
    {
      "Body": "<pre>表单提交人:@{outputs('Get_response_details')?['body/responder']}@{decodeUriComponent('%0A')}提交时间:@{outputs('Get_response_details')?['body/submitDate']}@{decodeUriComponent('%0A')}反馈内容:@{outputs('Get_response_details')?['body/r123456']}</pre>"
    }
    
  • 数组数据拼接换行:如果动态数据是数组形式,用join()函数将元素以<br>拼接,表达式示例:
    join(variables('动态数据数组'), '<br>')
    

注意事项

  • 确保HTTP请求的Content-Type设置为application/json,避免格式解析异常。
  • 测试时可直接写入纯HTML内容,验证SharePoint是否支持Body字段的HTML渲染。

内容的提问来源于stack exchange,提问作者James

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 09:46:59