Power Automate操作SharePoint列表报错:查无项/更新成功仍报错
问题1:无对应项时「Get Items」步骤报错
错误信息
The API 'sharepointonline' returned an invalid response for workflow operation 'Get_items' of type 'OpenApiConnection'. Error details: 'The API operation 'GetItems' is missing required property 'body/value/0/Location'.'
输入参数
{ "host": { "connectionReferenceName": "shared_sharepointonline", "operationId": "GetItems" }, "parameters": { "dataset": "https://<domain>.sharepoint.com/sites/<siteName>", "table": "7de34a0a-3343-dcdk-c9", "$filter": "Title eq '2450002'" } }
解决方法
- 给「Get Items」步骤开启运行后设置,勾选「即使失败也继续运行此操作」,避免流程直接中断。
- 在后续判断逻辑中,先通过表达式
length(outputs('Get_Items')?['body/value'])检查返回结果数组长度,只有当长度大于0时,再引用value[0].Location字段,防止空数组触发属性缺失错误。 - 测试流程与自动触发流程的行为差异,源于自动触发模式下流程引擎对响应schema的验证更严格,空结果时缺少必填字段的响应直接触发报错,而测试模式下验证逻辑更宽松。
问题2:「Update Item」步骤更新成功但报错
错误信息
The API 'sharepointonline' returned an invalid response for workflow operation 'Update_item' of type 'OpenApiConnection'. Error details: 'The API operation 'PatchItem' is missing required property 'body/Location'.'
解决方法
- 给「Update Item」步骤添加运行后设置,选择「仅当操作失败时才继续运行」,或指定忽略特定错误代码,避免更新成功后仍触发流程错误。
- 检查映射的「Address」字段是否存在空值:如果Address为空,手动给「Location」字段设置默认值(比如空字符串),确保请求体中始终包含Location字段,符合API必填要求。
- 若上述方法无效,替换「Update Item」为Send an HTTP request to SharePoint动作,手动构造Patch请求,示例请求体如下:
这种方式能精准控制请求内容,规避Power Automate内置动作的schema验证问题。{ "__metadata": { "type": "SP.Data.YourListNameListItem" }, "Location": "@{triggerBody()?['Address']}" }
内容的提问来源于stack exchange,提问作者Dmitriy Ryabin
相关产品推荐
相关产品推荐

