如何使用Microsoft Graph更新SharePoint中的查找字段和用户字段? [英] How to update a Lookup field and a user field in SharePoint with Microsoft Graph?

查看:60
本文介绍了如何使用Microsoft Graph更新SharePoint中的查找字段和用户字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种如何使用Microsoft graph更新查找字段和用户字段的方法? 我可以阅读该项目,但是即使输入正确的ID值,也找不到创建或更新此类字段的方法.

I'm looking for a way how to update a lookup field and a user field with Microsoft graph ? I can read the item, but I don't find a way to create or update this kind of field even if I put a correct ID value.

推荐答案

现在,它支持通过Microsoft Graph API更新查找字段.

Nowadays it is supported to update lookup fields via Microsoft Graph API.

让我们说有一个名为Category的字段,然后根据查找字段是以单值还是多值表示,下面的示例演示了如何设置查找字段值.

Lets say there is a field named Category, then depending whether lookup field is represented as single or multi valued, the following examples demonstrate how to set lookup field value.

用于单值字段:

Url: https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}/fields    
Method: PATCH 
Body: {
  "CategoryLookupId": "1"
}

其中

  • field name以以下格式提供:{field-name}LookupId
  • field value对应于查找ID,并以字符串形式提供
  • field name is provided in the following format: {field-name}LookupId
  • field value corresponds to lookup id and provided as a string

用于多值字段

Url: https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}/fields    
Method: PATCH 
{
    "CategoryLookupId@odata.type": "Collection(Edm.String)",
    "CategoryLookupId":["1","2"]
}

这篇关于如何使用Microsoft Graph更新SharePoint中的查找字段和用户字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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