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

查看:19
本文介绍了如何使用 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}LookupId
  • 字段值对应查找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天全站免登陆