OData 服务未返回完整响应

标签 odata

我正在使用 Odata RESTful 服务阅读 Sharepoint 列表数据(>20000 个条目),详见此处 -http://blogs.msdn.com/b/ericwhite/archive/2010/12/09/getting-started-using- the-odata-rest-api-to-query-a-sharepoint-list.aspx

我能够读取数据,但我只获得了前 1000 条记录。我还检查了 List View Throttling 在 Sharepoint 服务器上是否设置为 5000。请指教。

更新:

@Turker:你的回答很准确!!非常感谢。我能够在第一次迭代中获得前 2000 条记录。但是,我在 while 循环的每次迭代中都得到了相同的记录。我的代码如下-

                         ...initial code...
                     int skipCount =0;
  while (((QueryOperationResponse)query).GetContinuation() != null)
                {
                    //query for the next partial set of customers
                    query = dc.Execute<CATrackingItem>(
                        ((QueryOperationResponse)query).GetContinuation().NextLinkUri
                        );

                    //Add the next set of customers to the full list
                    caList.AddRange(query.ToList());

                    var results = from d in caList.Skip(skipCount)
                                  select new
                                  {
                                      Actionable = Actionable,
                                    };  Created = d.Created,

                        foreach (var res in results)
                        {

                            structListColumns.Actionable = res.Actionable;
                            structListColumns.Created= res.Created;
                        }
                         skipCount = caList.Count;
                     }//Close of while loop

最佳答案

你看到 <link rel="next"> 了吗? Feed 末尾的元素?

例如,如果你看

http://services.odata.org/Northwind/Northwind.svc/Customers/

你会看到

<link rel="next" href="http://services.odata.org/Northwind/Northwind.svc/Customers/?$skiptoken='ERNSH'" />

在提要的末尾,这意味着服务正在实现服务器端分页,您需要发送

http://services.odata.org/Northwind/Northwind.svc/Customers/?$skiptoken='ERNSH' 

查询以获得下一组结果。

关于OData 服务未返回完整响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6361813/

相关文章:

c# - 我可以更改用于 ODataController 请求的 ODataQueryOptions 吗?

c# - OData 新实体但部分有效负载

python - 在 Django (Python) 上实现 OData JSON 接口(interface)

javascript - 如何以安全的方式读写 OData 调用? (比如不容易受到 CSRF 攻击?)

wcf-data-services - WCF DataService 不支持预检选项请求?

linq - 是否有对 linq where 表达式的 ODATA 查询(ODATA 到 Linq)

wcf - 在运行时更改使用基本身份验证的 OData/WCF 数据服务的连接字符串

jquery - 可以从 Http 请求主体发布 ODataQueryOptions 吗?

angularjs - KendoUI Grid 具有自定义下拉列传递整个对象而不是 Id

c# - ODATA 从 C# ASP.NET 4.0 消费服务操作