Power将Http请求主体自动化为RemoteExecutionObject,如何从Input参数检索特定字段

问题描述

我具有Power自动运行功能,该功能可以通过webhook来动态运行,即触发器是HTTP请求。

该请求一旦运行,它将包含主体作为RemoteExecutionObject。

以下示例

Sub ReadFIle()
    Dim fileName As String: fileName = "C:\temp\yourfile.txt"
    
    Dim fileContent As String
    Dim File As Integer: File = FreeFile
    
    Open fileName For Input As #File
    fileContent = Input(LOF(File),File)
    
    Close #File
    
    ' example how to split the file in lines then
    Dim vDat As Variant
    vDat = Split(fileContent,vbNewLine)
    
End Sub

我希望在Power automate中从InputParameetrs中检索特定字段及其值。

Here is one close to example mentioning how it can be achieved. But it is still not clear

有人对它有想法吗?

解决方法

使用变量并一次使用一个数组/对象解决了这一特殊挑战。

例如:首先从Json检索InputParameters作为数组

triggerBody()['InputParameters']

然后使用索引0,以便获得完整的InputParameters作为对象

 triggerBody()['InputParameters'][0]

然后获得如下所示的值数组

triggerBody()['InputParameters'][0]['value']['Attributes']

,然后属性为数组

triggerBody()['InputParameters'][0]['value']['Attributes']

请注意,我们可以使用上述表达式直接检索属性。

现在要从Attributes数组中获取特定字段,我使用了power automate中的filter数组操作并将其用作

我们可以检索各个字段的类似方法

enter image description here