1

我正在尝试访问从两 (2) 个 Graph API 调用收到的 JSON 输出中的值,但每次尝试使用它们时都会收到此错误:

表达式评估失败。模板操作 'For_each' 的执行失败:'foreach' 表达式 '@body('Parse_JSON__-_Managed_Devices')?['body']?['value']' 的评估结果是 'Null' 类型。结果必须是有效的数组。

我已经验证我的 Graph API 调用格式正确,并且输出正是我期望从两个 API 调用返回的内容。每次我尝试访问 Azure Runbook 或任何其他逻辑应用任务中解析的 JSON 时都会收到此错误。

我很想知道是否有人以前经历过这种情况以及如何解决?

图查询: https ://graph.microsoft.com/beta/deviceManagement/managedDevices/?$select=id,userId,deviceName,userDisplayName,azureADDeviceId,managedDeviceName,emailAddress&$filter= operatingSystem eq 'windows'

托管设备的 JSON 架构

 {
 "properties": {
     "body": {
         "properties": {
             "@@odata.context": {
                 "type": "string"
             },
             "@@odata.count": {
                 "type": "integer"
             },
             "@@odata.nextLink": {
                 "type": "string"
             },
             "value": {
                 "items": {
                     "properties": {
                         "azureADDeviceId": {
                             "type": "string"
                         },
                         "deviceName": {
                             "type": "string"
                         },
                         "emailAddress": {
                             "type": "string"
                         },
                         "id": {
                             "type": "string"
                         },
                         "managedDeviceName": {
                             "type": "string"
                         },
                         "userDisplayName": {
                             "type": "string"
                         },
                         "userId": {
                             "type": "string"
                         }
                     },
                     "required": [
                         "id",
                         "userId",
                         "deviceName",
                         "userDisplayName",
                         "azureADDeviceId",
                         "managedDeviceName",
                         "emailAddress"
                     ],
                     "type": "object"
                 },
                 "type": "array"
             }
         },
         "type": "object"
     }
 },
 "type": "object"

}

图查询: https ://graph.microsoft.com/beta/users?$select=id,displayName,mail,officeLocation&$filter= accountEnabled eq true

用于用户 图形查询的 JSON 模式:https ://graph.microsoft.com/beta/users?$select=id,displayName,mail,officeLocation&$filter= accountEnabled eq true

 {
 "properties": {
     "body": {
         "properties": {
             "@@odata.context": {
                 "type": "string"
             },
             "@@odata.nextLink": {
                 "type": "string"
             },
             "value": {
                 "items": {
                     "properties": {
                         "displayName": {
                             "type": "string"
                         },
                         "id": {
                             "type": "string"
                         },
                         "mail": {
                             "type": "string"
                         },
                         "officeLocation": {
                             "type": "string"
                         }
                     },
                     "required": [
                         "id",
                         "displayName",
                         "mail",
                         "officeLocation"
                     ],
                     "type": "object"
                 },
                 "type": "array"
             }
         },
         "type": "object"
     }
 },
 "type": "object"

}

4

0 回答 0