SharePoint: Efficient way to retrieve all list items -
i retrieving items list containing around 4000 items. seems take longer time fetch items ~15 ~22 seconds. is there best way fetch items list in negligible time?
following code using fetch items:
using (spsite spsite = new spsite(site)) { using (spweb web = spsite.openweb()) { list = web.lists["listname"]; spquery query1 = new spquery(); string query = "<view>"; query += "<viewfields>"; query += "<fieldref name='id' />"; query += "<fieldref name='title' />"; query += "</viewfields>"; query += "<query>"; query += "<where>"; query += "<eq>"; query += "<fieldref name='colname'></fieldref>"; query += "<value type='boolean'>1</value>"; query += "</eq>"; query += "</where>"; query += "</query>"; query += "</view>"; query1.query = query; splistitemcollection listitems = list.getitems(query1); } }
normally when taking long retrieve items hitting boundary or limit.
first need test putting limit of query, return less 2000 items, or until find when starts becoming unbelievably slow.
then need see if can break query up, or multiple queries items depending on figure.
cheers
truez
Comments
Post a Comment