用图谱API在sharepoint在线中创建多选字段的POST主

用图谱API在sharepoint在线中创建多选字段的POST主

本文介绍了使用图谱API在sharepoint在线中创建多选字段的POST主体是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Microsoft Graph创建新的SharePoint ListItem.

I'm trying to create new SharePoint ListItem using Microsoft Graph.

要使用诸如Title之类的简单字段创建列表项,我的POST正文应如下所示:

To create a list item with simple fields like Title, my POST body looks like:

{
   "fields":{
       "Title":"Ehsan's REST"
   }
}

但是,一旦我添加了一个带有选择项值的字段,就会出现The request is malformed or incorrect.错误.

But as soon as I add a field with the multichoice value I get The request is malformed or incorrect. error.

示例:

{
   "fields":{
       "Title":"Ehsan's REST",
       "Languages": ["English","French"]
   }
}

在搜索过程中,我发现此论坛帖子,其中SharePoint API(不是Graph)要求将元数据属性添加到集合中作为对象:

During my search I found this forum post where SharePoint API (not Graph ) requires a metadata attribute to be added to the collection as an object:

"InternalFieldName":{
  "__metadata":{"type":"Collection(Edm.String)"},
  "results":["Value1","Value2","Value3"]
}

关于Microsoft图形文档github 的问题这个也是.

有什么建议吗?

推荐答案

感谢@Brad,它为我工作.我可以使用以下内容发布查找列的值

Thanks @Brad, it worked for me. I able to post lookup column values using following

"[email protected]": "Collection(Edm.Int32)",
"ProductsLookupId":[6,7,8]

产品是允许多选的查找列.

Where Products is a lookup column to allow multiple choice.

这篇关于使用图谱API在sharepoint在线中创建多选字段的POST主体是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 05:31