locked
GetListItems row limit problem RRS feed

  • Question

  • I am trying to bring back a list fot items from Sharepoint thru sharepoint web services.  The list contains 47 items, if i run the code below I get only 20 items back.  If I uncomment the rowlimit xml I still get only 20 rows back, so it doesn't appear to have any effect.  If I set the rowlimit in the GetListItems call to "2", i get 2, if I set it to "15", i get 15.  If I set it to "19", i get 19.  And with each of these my results change and they have the first line the xml showing paging.  If I don't set the limit the paged=True is not in the results and Itemcount="20".

    <rs:data ItemCount="19" ListItemCollectionPositionNext="Paged=TRUE&amp;p_ID=70"

    but if I set it to "21", i get 20.   No matter what I do I get 20 records or less.  Is there some setting in sharepoint that could be limiting this?  Is there somethign wrong with my code?  Have tried with multiple users ,all of which have admin access.

                    Dim listService As thewire.Lists = New myservice.Lists
                    listService.PreAuthenticate = True
    
                    listService.Url = URL
                    listService.Credentials = New System.Net.NetworkCredential(UserName, Password)
    
                    Dim list2 As XmlNode
    
                    Dim xmlDoc As New XmlDocument
                    Dim ndViewFields As XmlNode = xmlDoc.CreateElement("ViewFields")
                    Dim ndQueryOptions As XmlNode = xmlDoc.CreateElement("QueryOptions")
                    Dim ndQuery As XmlNode = xmlDoc.CreateElement("Query")
                    'ndQueryOptions.InnerXml = "<rowLimit>10</rowLimit>"
    
                    list2 = listService.GetListItems("Project Tracker", Nothing, ndQuery, ndViewFields, Nothing, ndQueryOptions, Nothing)

    Robert Ward
    Wednesday, December 2, 2009 4:23 PM

Answers

  • According to the SDK, what you're doing should work:
    rowLimit: A string that specifies the number of items, or rows, to display on a page before paging begins. If supplied, the value of this parameter overrides the row limit set in the view specified by the viewName parameter or the row limit set in the default view for the list.

    But in your case, obviously, this is not working! As a work around, perhaps try creating a seperate view on the list itself and give that view a Row Limit of 1000 or something like that. Then, try passing in the name of that view to your web method, and see if it gives you what you need.

    Not an elegant solution, but perhaps an adequate work-around.


    Visit my blog at blog.beckybertram.com or follow me on Twitter: @beckybertram
    • Marked as answer by DotNetRob.com Wednesday, December 2, 2009 8:23 PM
    Wednesday, December 2, 2009 5:26 PM

  • Was able to get it to load after reading on http://msdn.microsoft.com/en-us/library/lists.lists.getlistitems.aspx that the view had to be a GUID, not the name of the view.  Put the guid in and can bring back a view of the list and sure enough, it brings back all the records.  Still would love to figure out why the list is only bringing back 20 records thou.

    So this works, at least for Views.

    listService.GetListItems("Project Tracker", "{DC857713-18DF-4639-9952-84CBB75E17AC}", ndQuery, ndViewFields, Nothing, ndQueryOptions, Nothing)

    Thanks Becky.
    Robert Ward
    • Marked as answer by DotNetRob.com Wednesday, December 2, 2009 8:23 PM
    Wednesday, December 2, 2009 8:23 PM

All replies

  • According to the SDK, what you're doing should work:
    rowLimit: A string that specifies the number of items, or rows, to display on a page before paging begins. If supplied, the value of this parameter overrides the row limit set in the view specified by the viewName parameter or the row limit set in the default view for the list.

    But in your case, obviously, this is not working! As a work around, perhaps try creating a seperate view on the list itself and give that view a Row Limit of 1000 or something like that. Then, try passing in the name of that view to your web method, and see if it gives you what you need.

    Not an elegant solution, but perhaps an adequate work-around.


    Visit my blog at blog.beckybertram.com or follow me on Twitter: @beckybertram
    • Marked as answer by DotNetRob.com Wednesday, December 2, 2009 8:23 PM
    Wednesday, December 2, 2009 5:26 PM
  • There are actually a few views already setup on the list, all with 100 limits.  But I can't seem to get the views to come back

    Then tried to just create a new view, all default view settings except set limit to 1000, instead of 100 default.  Named it "test". 

    listService.GetListItems("Project Tracker", "All Active Projects", ndQuery, ndViewFields, Nothing, ndQueryOptions, Nothing)


    listService.GetListItems("Project Tracker", "test", ndQuery, ndViewFields, Nothing, ndQueryOptions, Nothing)

    but all just throw an exception, "Parameter viewName is missing or invalid".  So I must be not calling the view correctly of something else is wrong
    Robert Ward
    Wednesday, December 2, 2009 6:24 PM

  • Was able to get it to load after reading on http://msdn.microsoft.com/en-us/library/lists.lists.getlistitems.aspx that the view had to be a GUID, not the name of the view.  Put the guid in and can bring back a view of the list and sure enough, it brings back all the records.  Still would love to figure out why the list is only bringing back 20 records thou.

    So this works, at least for Views.

    listService.GetListItems("Project Tracker", "{DC857713-18DF-4639-9952-84CBB75E17AC}", ndQuery, ndViewFields, Nothing, ndQueryOptions, Nothing)

    Thanks Becky.
    Robert Ward
    • Marked as answer by DotNetRob.com Wednesday, December 2, 2009 8:23 PM
    Wednesday, December 2, 2009 8:23 PM
  • I just had a same problem and resolved it. Goto 'All Items' view (must be a default view) set the 'Item Limit' in List Settings to 1000. This resolved my problem.

    Thanks John


    Sastri

    Tuesday, March 20, 2012 9:09 AM