Microsoft Graph 更新 SharePoint 列表项多选字段 [英] Microsoft Graph update SharePoint list item multi choice field

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

问题描述

使用 Microsoft Graph 更新多选列表项字段的正确 JSON 语法是什么?

What is the proper JSON syntax to update a multi-choice list item field using the Microsoft Graph?

多选字段返回一个 json 字符串数组,例如:

Multi choice fields return a json array of strings like:

GET:/v1.0/sites/{siteId}/lists/{listId}/items/{itemId}

"CAG_x0020_Process_x0020_Status": [
    "Proposed Funding - Customer Billed",
    "Proposed Funding - Sales Funded",
    "SOW - Needed"
]

但是,当使用相同的语法更新字段时,会返回 400 无效请求.

However, when using the same syntax to update the field a 400 invalid request is returned.

补丁:/v1.0/sites/{siteId}/lists/{listId}/items/{itemId}/fields

"CAG_x0020_Process_x0020_Status": [
    "Proposed Funding - Customer Billed",
    "Proposed Funding - Sales Funded",
    "SOW - Needed"
]

返回错误:

{
  "error": {
    "code": "invalidRequest",
    "message": "The request is malformed or incorrect.",
    "innerError": {
      "request-id": "2251e25f-e4ce-491f-beb9-e463c7d8d5af",
      "date": "2018-05-16T15:16:23"
    }
  }
}

我能够更新所有其他请求的字段,但最后一个字段阻碍了应用程序的发布.

I am able to update all other fields requested, but this last field is holding up a release of the application.

推荐答案

这对我有用

graph.api(url)
  .version('beta')
  .post({
    'fields': {
      'AssignedToLookupId@odata.type': 'Collection(Edm.Int32)',
      'AssignedToLookupId': [5,13]
    }
  });

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

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