这是我在共享点创建新列表的URL。
http://mysite/_api/web/lists
标题
Accept:application/json
odata:verbose
X-RequestDigest:0x95F99ED44821F59DE52F628A82E4DFE6281D64349398251D47B063BEA15AA783C70656A30E0EC388C62E72E001B4F2BEB7AD716DAF1F63D79A170A8A4C299182,03 May 2016 07:01:30 -0000
content-type:application/json;
odata=verbose
content-length:6
身体
{
"parameters": {
"__metadata": {
"type": "SP.List"
},
"AllowContentTypes": true,
"BaseTemplate" : 100,
"ContentTypesEnabled": true,
"Description": "My ow list created",
"Title": "newList"
}
}
但是当试图在Postman中执行此URL时会出现以下错误
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-2130575252, Microsoft.SharePoint.SPException</m:code>
<m:message xml:lang="en-US">The security validation for this page is invalid and might be corrupted. Please use your web browser's Back button to try your operation again.</m:message>
</m:error>
有人可以指导我为什么要面对这个问题吗?
答案 0 :(得分:0)
此错误的可能原因是您的表单摘要已过期。
尝试通过向 / _ api / contextinfo 端点发出POST请求来制作新的表单摘要,然后在标题部分中替换它。
我已使用以下正文测试了您的代码,但它正在运行。
{
"__metadata": {
"type": "SP.List"
},
"AllowContentTypes": true,
"BaseTemplate" : 100,
"ContentTypesEnabled": true,
"Description": "My own list created",
"Title": "newList"
}