Sharepoint Web 服务 GetListItems 未返回所有行

发布于 2024-08-02 08:56:02 字数 73 浏览 2 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

月下客 2024-08-09 08:56:02

该方法仅检索列表默认视图中的行数。要解决此问题,您可以简单地增加默认视图中的行数,或者更好的是,使用 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

不气馁 2024-08-09 08:56:02

根据我的经验,你必须选择:
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. :)

沙沙粒小 2024-08-09 08:56:02

请参阅这篇文章,您返回的行数为根据您使用的视图,更改视图中的行限制。

Refer this article you number of rows returned is based on the View you have used, Change the rowlimit in the View.

感情废物 2024-08-09 08:56:02

GetListItems() 根据您在方法调用中用作第二个参数的视图的行限制来限制结果。如果您需要返回所有行:

  1. 使用您最喜欢(或最不喜欢)的 Web 浏览器转到您的 SharePoint 站点
  2. 导航到您的列表
  3. 选择与您用作 GetListItems() 方法调用的第二个参数的 GUID 相对应的视图(参见下面的示例)
  4. (从“视图”下拉菜单中)选择“修改此视图”
  5. 一直滚动到底部并展开“项目限制”
  6. 设置一个较高的数字(我使用 9000)作为“要显示的项目数” ”并选择“将退回的商品总数限制为指定数量”。
  7. 单击“确定”。

    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:

  1. Go to your SharePoint site using your favorite (or least favorite) Web Browser
  2. Navigate to your List
  3. Select the View which corresponds to the GUID you are using as the second parameter of your GetListItems() method call (see example below)
  4. Select (from the View drop-down menu) "Modify this View"
  5. Scroll all the way to the bottom and expand "Item Limit"
  6. Set a high number (I used 9000) as the "Number of items to display" and select "Limit the total number of items returned to the specified amount."
  7. 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.

寻找一个思念的角度 2024-08-09 08:56:02

仅供其他从 google 到达这里的人参考。

我需要从遗留系统中提取数据,并且碰巧遇到了同样的问题。不同之处在于我无法控制共享点列表,因此无法更改默认视图。

var items = listSvc.GetListItems(listname, null, null, null, null, null);

var pager = items.ChildNodes[1].Attributes["ListItemCollectionPositionNext"] != null ? items.ChildNodes[1].Attributes["ListItemCollectionPositionNext"].Value : string.Empty;
var pagerXml = new XmlDocument();
pagerXml.InnerXml = "<QueryOptions><Paging ListItemCollectionPositionNext=\"\" /></QueryOptions>";
var pagerNode = pagerXml.GetElementsByTagName("QueryOptions")[0];

while (!string.IsNullOrEmpty(pager))
{
    pagerNode.ChildNodes[0].Attributes[0].Value = pager;
    var temp = listSvc.GetListItems(listname, null, null, null, null, pagerNode);
    foreach (XmlNode c in temp.ChildNodes[1].ChildNodes)
    {
        var c2 = items.OwnerDocument.ImportNode(c, true);
        items.ChildNodes[1].AppendChild(c2);
    }

    pager = temp.ChildNodes[1].Attributes["ListItemCollectionPositionNext"] != null ? temp.ChildNodes[1].Attributes["ListItemCollectionPositionNext"].Value : string.Empty;
}

这是一次性使用的代码,所以我把它留给读者来整理它:D

但要点是,如果你不能在一次调用中获取它,只需使用视图页面大小作为批量大小来批量获取它。 GetListItems() 的最后一个参数接受 XmlNode 参数,您可以传递类似以下内容:

<QueryOptions><Paging ListItemCollectionPositionNext="{paging-option}" /></QueryOptions>

其中 {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.

var items = listSvc.GetListItems(listname, null, null, null, null, null);

var pager = items.ChildNodes[1].Attributes["ListItemCollectionPositionNext"] != null ? items.ChildNodes[1].Attributes["ListItemCollectionPositionNext"].Value : string.Empty;
var pagerXml = new XmlDocument();
pagerXml.InnerXml = "<QueryOptions><Paging ListItemCollectionPositionNext=\"\" /></QueryOptions>";
var pagerNode = pagerXml.GetElementsByTagName("QueryOptions")[0];

while (!string.IsNullOrEmpty(pager))
{
    pagerNode.ChildNodes[0].Attributes[0].Value = pager;
    var temp = listSvc.GetListItems(listname, null, null, null, null, pagerNode);
    foreach (XmlNode c in temp.ChildNodes[1].ChildNodes)
    {
        var c2 = items.OwnerDocument.ImportNode(c, true);
        items.ChildNodes[1].AppendChild(c2);
    }

    pager = temp.ChildNodes[1].Attributes["ListItemCollectionPositionNext"] != null ? temp.ChildNodes[1].Attributes["ListItemCollectionPositionNext"].Value : string.Empty;
}

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 an XmlNode parameter and you can pass something like:

<QueryOptions><Paging ListItemCollectionPositionNext="{paging-option}" /></QueryOptions>

where {paging-option} is the value of the attribute (same name) of rs:data

悸初 2024-08-09 08:56:02

将 rowLimit 设置为 0

var rowLimit = "0";
var result = client.GetListItems("ListName", null, query, viewFields, rowLimit, queryOptions, null);

注意超时。如果您的 SharePoint 列表中有很多项目,那么您可能会遇到 http 超时。可以在 SharePoint 网站的 IIS 和 web.config 中更改超时

Set rowLimit to 0

var rowLimit = "0";
var result = client.GetListItems("ListName", null, query, viewFields, rowLimit, queryOptions, null);

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文