使用Microsoft Graph创建带有查找字段的SharePoint列表项 [英] Create SharePoint list item with lookup field with Microsoft Graph

查看:53
本文介绍了使用Microsoft Graph创建带有查找字段的SharePoint列表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Microsoft Graph的新SharePoint终结点创建列表项.我的网址如下: https://graph.microsoft.com/beta/sites/ {site-id} /lists/{list-id}/items

I am trying to create list items with Microsoft Graph's new SharePoint endpoint. My URL is as follows: https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items

使用POST调用此URL,并使用如下内容:

Calling this URL with POST, and a body like this:

{
    "fields": {
        "Title": "test",
    }
}

..有效!但是,如果我包括一个查找字段,则查找字段始终为空.我尝试过

.. works! But if I include a lookup field, the lookup field is always empty. I have tried with

"{columnName}": "id",

"{columnName}": "id;#value",

"{columnName}": {
    "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", //and others like this
    "Id": "id",
    "Value": "value",
}

"{columnName}": "value",
"{columnName}Id": "id",

这些似乎都不起作用.有些会显示错误消息,例如请求的格式不正确或不正确.",其他则通过,但不包含查找字段.

None of these seems to work. Some give an error like "The request is malformed or incorrect.", others go through, but doesn't include the lookup field.

关于此的文档很稀少(如果有的话),而我在google上发现的信息很少(除了有人问同样的问题而没有答案).有人让它起作用了吗?甚至有可能吗?

The documentation for this is scarce (if any), and I have found very little information on google (apart from someone asking the same question with no answers). Anyone that got this to work yet? Is it even possible?

推荐答案

我已经将其用于禁用了多项选择选项的人员字段.因此,如果您有一个只允许一个人的人员字段,则可以进行以下操作.

I have got this to work with people fields where the multiple selection option was DISABLED. So if you have a person field which allows one person only, the following works.

"{columnName}LookupId": id

此外,该ID仍需要是SP ID,而不是图形用户GUID.此ID在站点之间更改.

Additionally, the id still needs to be the SP ID and not the graph user GUID. This ID changes from site to site.

这篇关于使用Microsoft Graph创建带有查找字段的SharePoint列表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆