图表API POST到Sharepoint在线列表 [英] Graph API POST to Sharepoint Online List

查看:67
本文介绍了图表API POST到Sharepoint在线列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我目前正在开发一个与Sharepoint Online网站集成的应用程序。应用程序提出问题并将数据提交到站点上的共享点列表。一切正常,但如果列是Choice - Checkbox列,则会出现格式错误的
JSON错误。我一直在寻找正确的方法来向这种类型的sharepoint列提交数据但却一无所获。 

I'm currently developing an application that integrates with a Sharepoint Online site. The application asks questions and submits the data to a sharepoint list on the site. Everything works fine, but if the column is a Choice - Checkbox column, I get a malformed JSON error. I've been looking everywhere for the correct way to submit data to this type of sharepoint column but have found nothing. 

这是一个身体外观的例子。唯一不提交的项目是"Line_x0020_Type"。 column,这是一个允许多个选择的Choice列。我最初尝试发送一个字符串数组,但经过一些调试后,
列formValue,如果我直接从Sharepoint创建一个列表项,则是";#CATV; #Phone;#"我认为这很奇怪,因为如果我执行GET,字段将显示为字符串元素的数组。下面的主体虽然反映了该列的formValue
,但仍无法正常工作。任何帮助将不胜感激。 

Here is an example of what the body looks like. The only item that won't submit is the "Line_x0020_Type" column, which is a Choice column that allows multiple selections. I tried sending an array of strings initially, but after a little debugging, the column formValue, if I created a list item directly from Sharepoint, was ";#CATV;#Phone;#" which I thought was strange because if I do a GET the field is displayed as an array of string elements. The below body, although reflects the formValue of the column, still does not work. Any help would be appreciated it. 

推荐答案

多个复选框值的Json数据是这样的字符串数组:

The Json data for Multiple Checkbox value is a string array like this:

不熟悉Graph API,但是对于使用Rest API发布的Json数据,此字段应设置如下:

Not Familiar with Graph API, but for Json data to post with Rest API, this field should be set like this:

var itemmetadata = {
        "__metadata": { "type": 'SP.Data.RestpostListItem'},
        "Title": "value change",
        "Line_x0020_Type":{'results':["Line1","Line2","Line3"]}  
    };
    

按预期工作以设置多个复选框列的值:

Worked as expected to set value for multiple checkbox column:

谢谢

最好的问候


这篇关于图表API POST到Sharepoint在线列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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