Working with large amount of list items

Hi there,

  1. I create a list called mylist in my rootsite, Title ,Description, DummyField, and created 3 indexes with this columns
  2. I populated with 150000 items
  3. i use this code to interact with the items (I have Listthrottling enabled to 5000)

do
{
SPListItemCollection myItemcoll = list.GetItems(myQuery);
DataTable dt = myItemcoll.GetDataTable();

int maxCount = dt.Rows.Count;
for (int i = 0; i < maxCount; i++)
{

Console.WriteLine(“Item title:{0}”, dt.Rows[i][“Title”]);

}

myQuery.ListItemCollectionPosition = myItemcoll.ListItemCollectionPosition;

} while (myQuery.ListItemCollectionPosition != null);

First thing first:

  1. Try to always use DataTable and Datarows in interaction (ligthrer objs->better performance)
  2. Use constants gathering the maxcount (dont use the myItemcoll.Count ->bad performance and bad practice)

All the items where returned , its not missing even one.

I hope it helps u in your demand

Any question feel free to ask

Best regards

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s