SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to retrieve items/list items from SharePoint 2010 document library and display it in a list ListView using C#. I have used following CAML query to retrieve list items and its properties.

camlQuery.ViewXml = "<View><Query><Where><Geq><FieldRef Name='ID'/><Value Type='Number'>" + id.ToString() + "</Value></Geq></Where></Query><RowLimit>100</RowLimit></View>"; 
                        ListItemCollection collListItem = oList.GetItems(camlQuery);

                        if (id != 0)
                            items = context.LoadQuery(collListItem.Include
                                                    item => item.File.ListItemAllFields,
                                                    item => item.FileSystemObjectType,
                                                    item => item.Id,                     
                                                    item => item.File,
                                                    item => item.File.ServerRelativeUrl,
                                                    item => item.DisplayName
                                                     ).Where(item => item.Id > id && item.FileSystemObjectType == FileSystemObjectType.File));

Since you would have noticed I have set Row limit to 100 so this works fine, as soon as I increase the limit to about 1000 it slows considerably, taking more than 7 seconds to get query result which is just not acceptable. Is there any other way the I can optimize my query to make it work faster to get about 1000 items in some milliseconds. This is frustrating because reloading items in ListView also adds up to time when loading items using paging.

Need some guidance.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.