【问题标题】:Extract file from http response in Azure logic app从 Azure 逻辑应用中的 http 响应中提取文件
【发布时间】:2019-08-09 21:41:38
【问题描述】:

我有一个 Azure 函数(http 触发),它返回一个 CSV 文件作为响应。我正在使用 http 请求操作(因为我需要传递身份验证详细信息)从逻辑应用程序调用此函数,并使用正文中的 CSV 获取 http 响应。现在我想将此 CSV 作为附件与 Outlook 电子邮件一起发送。不幸的是,我无法做到这一点。如果我使用 http 响应的正文,则电子邮件正文包含 CSV 的完整内容,而我希望将其作为附件。

提前致谢。

问候, 某人

【问题讨论】:

    标签: azure azure-functions httpresponse azure-logic-apps html-content-extraction


    【解决方案1】:

    我就是这样解决的。

    这是我的示例 Azure 函数和逻辑应用配置

    [FunctionName("Function1")]
            public static IActionResult Run(
                [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
                ILogger log)
            {
                log.LogInformation("C# HTTP trigger function processed a request.");
                var csvFile = new StringBuilder();
                csvFile.AppendLine(string.Format("{0},{1}", "1", "ABC"));
                csvFile.AppendLine(string.Format("{0},{1}", "2", "ABcd"));
                csvFile.AppendLine(string.Format("{0},{1}", "3", "ABCde"));
                csvFile.AppendLine(string.Format("{0},{1}", "4", "ABCdef"));
                csvFile.AppendLine(string.Format("{0},{1}", "5", "ABCdefg"));
                csvFile.AppendLine(string.Format("{0},{1}", "6", "ABCdefgh"));
                return new OkObjectResult(csvFile.ToString());
            }
    

    让我们知道这是否适合您..我们可以对 Outlook 帐户做同样的事情..我只使用了 gmail 帐户。

    【讨论】:

    • 我的错。我做了同样的事情,但没有指定附件名称。它在指定文件名后起作用。感谢您的回答。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-11-06
    • 2022-09-27
    • 1970-01-01
    • 1970-01-01
    • 2019-01-14
    • 2019-05-08
    • 2022-06-16
    相关资源
    最近更新 更多