SharePoint创建列表REST API [英] SharePoint Create List REST API

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

问题描述

我们需要在SharePoint中创建不同类型的列表。我们为根网站创建了一个子网站,我们尝试在此子网站中创建列表。但是我们在创建BaseTemplate值列表时遇到错误,如下所示:

We have a requirement to create different types of lists in SharePoint. We have a subsite created for our root web and we tried to create lists in this subsite. But we are getting an error while creating a list with BaseTemplate values as below:

151,160,  175,  200,201,  202,  204,  207,  210,  211,  212,  301,302,  303,  402,  403,  404,  405,  420,  421,  499,  600,  700,  1200,  1220,  1221,  1230

以下是示例请求和我们得到的错误。

Below is the sample request and the error that we got.

网址:

POST {my_root_web}/listTest/_api/web/lists




请求有效载荷:

{	"AllowContentTypes": true,	"BaseTemplate": 1230,	"ContentTypesEnabled": true,	"Description": "My list description",	"Title": "List_1230"}

错误:

{    "odata.error": {        "code": "-2130575237, Microsoft.SharePoint.SPException",        "message": {            "lang": "en-US",            "value": "Invalid list template."        }    }}

我们正在裁判  SPListTemplateType枚举 可能的列表类型。

We are refereeing SPListTemplateType enumeration for the possible list types.

任何帮助都将不胜感激。

Any help would be appreciated.

BrajMohan

BrajMohan

推荐答案

这是因为并非所有列表模板类型都在具有Rest Api模型的SharePoint中公开。你 可以通过在您的网站中使用以下EndPoint URI结构来验证可用于rest api的列表模板:

This is because not all list template types are exposed in SharePoint with Rest Api model. You  can verify the list templates available for rest api by using below EndPoint URI structure in your web :

http://< sitecollection> /< site> / _ api / web / ListTemplates

要在IE中将Atom feed的读取模式更改为xml:

To change the reading mode from Atom feed to xml in IE :

转到IE设置 - Internet选项 - >内容 - > Feed和Web Slices - >设置并取消选中"启用Feed阅读视图"

Go to IE settings - Internet Options -> Content -> Feed and Web Slices -> Settings and uncheck "Turn on feed reading view"

Ref.

同样,并非所有列表模板类型都在SharePoint for Object Model中公开。   Ref。








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

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