【发布时间】:2015-08-19 20:46:51
【问题描述】:
我正在使用 Sharepoint REST API 从 NodeJS 获取/修改 Sharepoint 中的数据。
我收到了来自 Sharepoint REST API 的 odata 响应,并且一切都按预期工作。 除了一件事。
目前我收到了来自 Sharepoint REST API 的响应,如下所示
{
"odata.metadata": "https://test.sharepoint.com/_api/$metadata#SP.ApiData.Lists",
"value": [
{
"odata.type": "SP.List",
"odata.id": "https://test.sharepoint.com/_api/Web/Lists(guid'sample-guid')",
"odata.etag": "\"6\"",
"odata.editLink": "Web/Lists(guid'sample-guid')",
"AllowContentTypes": true,
"BaseTemplate": 160,
"BaseType": 0,
"ContentTypesEnabled": true,
"CrawlNonDefaultViews": false,
"Created": "2015-05-19T11:13:46Z",
"DefaultContentApprovalWorkflowId": "00000000-0000-0000-0000-000000000000",
"Description": "Use this list to track access requests to a site or uniquely permissioned items in the site.",
"Direction": "none",
"DocumentTemplateUrl": null,
"DraftVersionVisibility": 0,
"EnableAttachments": false,
"EnableFolderCreation": false,
"EnableMinorVersions": false,
"EnableModeration": false,
"EnableVersioning": true,
"EntityTypeName": "AccessRequests",
"FileSavePostProcessingEnabled": false,
"ForceCheckout": false,
"HasExternalDataSource": false,
"Hidden": true,
"Id": "sample-id",
"IrmEnabled": false,
"IrmExpire": false,
"IrmReject": false,
"IsApplicationList": false,
"IsCatalog": false,
"IsPrivate": false,
"ItemCount": 1,
"LastItemDeletedDate": "2015-05-19T11:13:46Z",
"LastItemModifiedDate": "2015-08-04T06:57:22Z",
"ListItemEntityTypeFullName": "SP.Data.AccessRequestsItem",
"MajorVersionLimit": 0,
"MajorWithMinorVersionsLimit": 0,
"MultipleDataList": false,
"NoCrawl": true,
"ParentWebUrl": "/",
"ParserDisabled": false,
"ServerTemplateCanCreateFolders": true,
"TemplateFeatureId: "sample-id",
"Title": "Test Title"
}, {
........
}]
}
在上述回复中,我得到了与 Sharepoint System 相关的字段以及我想要的字段。 例如:odata.type、odata.id、AllowContentTypes、BaseTemplate 等
我如何获得我需要的字段,而不是其他与 Sharepoint 相关的字段。
有人可以帮忙吗?
谢谢
【问题讨论】:
-
你为什么打电话给
/_api/$metadata#SP.ApiData.Lists而不是/_api/web/lists? -
我只打电话给
/_api/web/lists。它给了我上面粘贴的回复。
标签: node.js sharepoint odata