It is a known fact that once the treshold limit is reached in SP, everything seems frozen. At this point you have some options. Increase the limit using powershell or from the Central Admin OR Index the columns that you will like to operate on and create views based on those.
However programmatically if you want to sum a list that has reached its threshold. You can do so in batches as hown below:
However programmatically if you want to sum a list that has reached its threshold. You can do so in batches as hown below:
protected void GetSummary(out long ideas, out long votes, out long comments, out long transform) { long ideasum = 0; long columntoSum = 0; long commentSum = 0; long transformSum = 0; SPSite site = SPContext.Current.Site; SPWeb web = site.RootWeb; SPList ideaList = web.Lists.TryGetList("ListName"); //Get the maximum number of items in the list
double idealimit = MaxId(); //this function is explained in one of my posts(http://www.blogger.com/blogger.g?blogID=2123753259723977594#editor/target=post;postID=9105210765468295611;onPublishedMenu=allposts;onClosedMenu=allposts;postNum=1;src=postname) double noOfTimes = Math.Ceiling(idealimit / 5000); int start = 0; int end = 0; for (int i = 0; i < noOfTimes; i++) { start = i * 5000; end = start + 5000; SPQuery query = new SPQuery(); query.RowLimit = 5000; query.Query = string.Format(@"", start, end); SPListItemCollection items = ideaList.GetItems(query); DataTable dt = null; dt = items.GetDataTable(); if ((null != dt) && (dt.Rows.Count > 0)) { string sqlFilter = string.Format("IdeaStatus LIKE '%{0}%'", "Active"); DataRow[] foundRows; foundRows = dt.Select(sqlFilter); if (foundRows.Count() > 0) { foreach (DataRow item in foundRows) { columnSum += Convert.ToInt64(item["columntoSum"]); } } } } comments = commentSum; } {0} {1} Active
Comments