共享点列表-使用查找值创建项目

时间:2020-05-27 12:47:22

标签: json sharepoint graph

https://docs.microsoft.com/de-de/graph/api/listitem-create?view=graph-rest-1.0&tabs=http

说明如何在简单列表中为“创建项目”创建JSON POST。

我正在寻找一个带有查找列的示例-因为“获取响应”的剪切和过去无法用于列表字段定义。

例如

{
    "fields": {
        "Title": "2020-of-003",
        "F8_LOOKUP": [
            {
                "LookupId": 6,
                "LookupValue": "Alfred Anders"
            }
        ]
    }
}

1 个答案:

答案 0 :(得分:0)

只需将LookupId连接到您的字段名称,然后添加odata.type即可进行多查询 https://github.com/microsoftgraph/microsoft-graph-docs/issues/2991#issuecomment-443347657

POST
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items

多查询:

{
  "fields": {
    "Title": "From graph",
    "fieldnameLookupId@odata.type": "Collection(Edm.Int32)",
    "fieldnameLookupId": [1,2]
  }
}

查找:

{
  "fields": {
    "Title": "From graph",
    "fieldnameLookupId": 1
  }
}