首页 文章

Microsoft Graph更新SharePoint列表项多选字段

提问于
浏览
1

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

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

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无效请求 .

补丁: /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"
    }
  }
}

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

3 回答

  • 0

    遗憾的是,今天无法通过Microsoft Graph更新许多列类型,包括 MultiChoice . 我建议将其添加到Office Dev UserVoice,以便它仍然在SharePoint / Graph团队的雷达上 .

  • 0

    我可以使用以下方法发布多个lookupids

    "ProductsLookupId@odata.type": "Collection(Edm.Int32)",
        "ProductsLookupId":[6,7,8]
    

    我按照stackoverflow的回复提出了建议

  • 0

    这适合我

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

相关问题