【问题标题】:Is there a way to return data from the called azure function back to logic app who called it?有没有办法将数据从被调用的天蓝色函数返回给调用它的逻辑应用程序?
【发布时间】:2020-12-12 22:20:06
【问题描述】:
  1. 我有 Office 365 触发器“新电子邮件何时到达?”
  2. 我用值 Max Sample 初始化变量用户名
  3. 然后调用天蓝色函数FxNet21HttpTrigger1 并且如果确定逻辑应用程序的用户名是否可以在此处更改,则返回另一个变量
  4. 检查用户名,如果是“Donald Duck”则做一件事,如果不是则做另一件事

我正在寻找一种在 azure 函数中设置值并对逻辑应用中的值作出反应的最小方法。

Logic App Designer Screenshot

【问题讨论】:

    标签: c# azure-logic-apps azure-functions-runtime data-exchange


    【解决方案1】:

    这是使用版本 1 的 Azure 函数(版本 2 和 3 类似):

    using System.Net;
    using System.Net.Http;
    
    ....
    
    [FunctionName("MyFunction")]    
    public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log)
    {    
        return new GetHtmlResponseContent("<html><body>Hello <b>world</b></body></html>"};
    }
    
    private static HttpResponseMessage GetHtmlResponseContent(string msg, HttpStatusCode httpStatusCode)
    {
        var response = new HttpResponseMessage(httpStatusCode);
        response.Content = new StringContent(msg));
        response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
    
        return response;
    }  
    

    您可能希望返回包含您的返回值的 JSON 有效负载。

    How do I return JSON from an Azure Function

    【讨论】:

      猜你喜欢
      • 2018-09-07
      • 1970-01-01
      • 2019-08-19
      • 2020-05-08
      • 2011-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多