Sharepoint Web 服务 GetListItems 未返回所有行
我正在使用 GetListItems Web 服务,它仅返回存储结果的大约 50%。可以返回的数据量是否有限制?无论如何还有这个吗?
I am using the GetListItems web service and it is only returning about 50% of the results stored. Is there a limit to how much data can be returned? Is there anyway round this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
该方法仅检索列表默认视图中的行数。要解决此问题,您可以简单地增加默认视图中的行数,或者更好的是,使用 CAML 查询。以下是有关如何将 CAML 与 Web 服务结合使用的文章:
http://dotnet.org.za/zlatan/archive/2007/08/01/collaborative-application-markup-language-caml-and-webservices-in-sharepoint-2007.aspx
The method retrieves only the number of rows in the default view of the list. To solve this problem, you can simply increase the row count in your default view, or better yet, use CAML queries. Here's an article on how to use CAML with web services:
http://dotnet.org.za/zlatan/archive/2007/08/01/collaborative-application-markup-language-caml-and-webservices-in-sharepoint-2007.aspx
根据我的经验,你必须选择:
1. 将调用 getlistitems 方法时使用的视图更改为返回所有行的正确视图
2. 检查是否在 getlistitems 方法中设置了 rowlimit。如果您想返回当前视图中的所有内容,可以使用“0”,请参阅下面的示例:
XmlNode doc = doclist.GetListItems("我的列表", "我的视图", query, viewFields, "0", queryOptions, null);
您还可以尝试转到 SharePoint 网站,转到要从中提取的列表,然后选择设置并修改默认视图/创建您自己的视图并展开“总计”组。在“总计”组下,查找列表的唯一标识符(例如 ID),然后在其旁边的下拉列表中选择“COUNT”,然后保存您的视图。列表重新加载后,将此视图中现在显示的总数与查询返回的项目数进行比较。如果它们仍然不一样,请告诉我。 :)
From my experience you have to options:
1. Change the view you use when calling the getlistitems method to the correct view which returns all rows
2. Check and see if you placed a rowlimit in your getlistitems method. If you want to return everything in the current view that you have you can use "0" see example below:
XmlNode doc = doclist.GetListItems("My List", "My View", query, viewFields, "0", queryOptions, null);
You can also try and go to your SharePoint site, go to the list you are pulling from then select settings and modify the default view/create your own view and expand the Totals group. Under the Totals group, look for a unique identifier for your list (eg. ID) then in the dropdown beside it select COUNT then save your view. Once the list reloads compare the total number which will now be shown in this view with the number of items returned by your query. Let me know if they are still not the same. :)
请参阅这篇文章,您返回的行数为根据您使用的视图,更改视图中的行限制。
Refer this article you number of rows returned is based on the View you have used, Change the rowlimit in the View.
试试这个,
SharePoint 列表 Web 服务 GetListItems
Try this,
SharePoint List Web Service GetListItems
GetListItems() 根据您在方法调用中用作第二个参数的视图的行限制来限制结果。如果您需要返回所有行:
单击“确定”。
Service.GetListItems(ListGuid, ViewGuid, query, viewFields, RowLimit, queryOptions, null);
如果 RowLimit 方法参数小于您在 SharePoint 中设置的视图行限制,则结果将限制为该参数值。
GetListItems() limits results based on the Row Limit of the View you are using as the second parameter in the method call. If you need all rows to be returned:
Click OK.
Service.GetListItems(ListGuid, ViewGuid, query, viewFields, RowLimit, queryOptions, null);
If the RowLimit method parameter is less than the View Row Limit you had set up in SharePoint, then the results are limited to the parameter value.
仅供其他从 google 到达这里的人参考。
我需要从遗留系统中提取数据,并且碰巧遇到了同样的问题。不同之处在于我无法控制共享点列表,因此无法更改默认视图。
这是一次性使用的代码,所以我把它留给读者来整理它:D
但要点是,如果你不能在一次调用中获取它,只需使用视图页面大小作为批量大小来批量获取它。
GetListItems()
的最后一个参数接受XmlNode
参数,您可以传递类似以下内容:其中
{paging-option}
是rs:data
的属性(同名)Just for reference to other people who get here from google.
I need to extract data from a legacy system and happen to have this same exact problem. The difference is I didn't have control over the sharepoint list so I can't change the default view.
This is one time use code, so I leave it to the reader to tidy it up:D
but the gist is, if you can't get it in one call, just get it in batches using the view page size as the batch size. The last argument of
GetListItems()
accepts anXmlNode
parameter and you can pass something like:where
{paging-option}
is the value of the attribute (same name) ofrs:data
将 rowLimit 设置为 0
注意超时。如果您的 SharePoint 列表中有很多项目,那么您可能会遇到 http 超时。可以在 SharePoint 网站的 IIS 和 web.config 中更改超时
Set rowLimit to 0
Beware of timeouts. If you have lot of items in your SharePoint list then you might hit http timeout. Timeouts can be changed in IIS and web.config of your SharePoint site