这是我使用 RenderListDataAsStream 端点检索列表数据的 ajax 调用。
var payload = {
'parameters': {
RenderOptions: 2
}
};
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists(guid'<list-id>')/RenderListDataAsStream",
type: "POST",
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'X-RequestDigest': $("#__REQUESTDIGEST").val() },
body: JSON.stringify(payload),
success: function (data) {
console.log(data);
},
error: function (error) {
alert(JSON.stringify(error));
}
});
相同的代码在 SharePoint Online 中运行,但给出如下错误:
{"error":{"code":"-1, Microsoft.SharePoint.Client.ResourceNotFoundException","message":{"lang":"en-US","value":"找不到请求 RenderListDataAsStream 的资源."}}}
此问题仅在 SP2013 中特别存在。