locked
How to get all of the items from list RRS feed

  • Question

  • Hi Guys I have a problem with getting all elements from list.

    SpList list = web.Lists[guid];

    SpView view = list.Views[0];

    SpListItemCollection items = list.GetItems(view);

    If the RowLimit is set I'm getting only the limited number of values. The rest isn't matched

    If someone knows how to get all the items please help me.

    Regards
    Michal
    Saturday, September 20, 2008 4:04 PM

Answers

  • If you looking at getting all the items, the following code should let you iterate over them

    using (SPSite curSite = new SPSite(SITE_URL))  
    {  
        using (SPWeb curWeb = curSite.RootWeb)  
        {  
     
            SPList oList = curWeb.GetList(curWeb.ServerRelativeUrl + "/Shared%20Documents/");  
     
            foreach(SPListItem itm in oList.Items)  
            {  
                //do something will each list item  
            }  
     
        }  

    Tony Testa www.tonytestasworld.com
    • Marked as answer by jazzman13 Saturday, September 20, 2008 6:05 PM
    Saturday, September 20, 2008 4:41 PM

All replies

  • If you looking at getting all the items, the following code should let you iterate over them

    using (SPSite curSite = new SPSite(SITE_URL))  
    {  
        using (SPWeb curWeb = curSite.RootWeb)  
        {  
     
            SPList oList = curWeb.GetList(curWeb.ServerRelativeUrl + "/Shared%20Documents/");  
     
            foreach(SPListItem itm in oList.Items)  
            {  
                //do something will each list item  
            }  
     
        }  

    Tony Testa www.tonytestasworld.com
    • Marked as answer by jazzman13 Saturday, September 20, 2008 6:05 PM
    Saturday, September 20, 2008 4:41 PM
  •  Thanks Tony :)
    Saturday, September 20, 2008 6:05 PM