SharePoint view limit - sharepoint

I have created an application and display data with JSOM. My problem is the limit of the view. I have set the row limit and is working fine if I get all items where ID is greater than zero, which is bringing all the items from the list. I also added a new column (indexed) and the query is failing when the second filter is giving me more than 5000 items. I really have no idea what is the difference. ID is automatically indexed, the second one was created by me. I can only guess index was not created because I have exceeded 5000 items, but as I heard, in SharePoint Online this limit is higher.

The list item retrieval limit on SharePoint Online is 5,000 and cannot be changed. Technically, it can be changed in the same way you would increase this limit for a SharePoint on prem instance, but Microsoft is the only ones with access to those settings in SharePoint Online and they're not going to change it.
This user voice request has been pending for 6 years now though it does have a "Working on it" status so maybe in the next couple of years.
In the mean time, you will need to implement pagination like this:
ClientContext clientContext = new ClientContext(<YourSiteURL>);
List list = clientContext.Web.Lists.GetByTitle(<YourListTitle>);
ListItemCollectionPosition itemPosition = null;
do
{
CamlQuery camlQuery = new CamlQuery();
camlQuery.ListItemCollectionPosition = itemPosition;
camlQuery.ViewXml = #"<View><ViewFields><FieldRef Name=’Title’/></ViewFields><RowLimit>5000</RowLimit></View>";
ListItemCollection listItems = list.GetItems(camlQuery);
clientContext.Load(listItems);
clientContext.ExecuteQuery();
itemPosition = listItems.ListItemCollectionPosition;
//Now process the items
foreach (ListItem listItem in listItems)
{
//Do something
}
} while (itemPosition != null)
If your app is unable to retrieve more than 5,000 items, you need to use pagination to get all the items in a large list in chunks of 5,000 until you have all of them. The above code snippet does just that.
If you're trying to modify a view directly on the SharePoint list, those won't allow more than 5,000 items to be retrieved. It becomes doubly messy when you consider that it isn't the final result set that counts, but the total POSSIBLE number of rows since the calculation is done on the SQL Server side. In your example you're probably trying to filter by the second column you created. Since the list has more than 5,000 items, the view fails because the column you created is not an indexed auto number field like the ID field. As a result, in order to return your view SQL Server has to select ALL the rows in the list in order to sort and filter by your column. Consider this.
The internal database structure for SharePoint lists stores all rows from all lists in ONE table named AllRows.
By default, SQL Server automatically upgrades row locks to table locks when the number of row locks on a given table exceeds 5,000. This is a performance consideration from the dinosaur age when RAM was at a premium in servers.
In any large list scenario, if SQL Server was to upgrade the row lock to a table lock, it would essentially block any and all other lists in SharePoint from being updateable. For this reason, it will block any return of more than 5,000 items to the list.
You could try to add filter to your view based on the ID field e.g. ID <= 5000 for a view called "0-5000" and then ID > 5000 && ID <= 10000 for another view called "5001-10000".
Its not the greatest solution, but it's a workable one. ;-)

Related

Problem with OData query in Microsoft Flow for GetItems action on a SharePoint list having 20000+ rows

I have created a Microsoft Flow (PowerAutomate), to retrieve records from a SharePoint list. The list has 22,300 records in it. I have written the below OData filter query. The column (Email) is of Person type.
Email/EMail eq 'me.someone#company.com'
But none of the records are retrieved. However, if I give the below query, the same record is retrieved.
ID eq 22102
The list contains the below records.
ID
Email
22102
Me someone
2
another person
However, if I query for the email id of the 2nd record (another.person#company.com), it is retrieved fine.
Email/EMail eq 'another.person#company.com'
I am wondering is there any limitation towards retrieving records greater than 20000? Really surprised why the second record is retrieved and not the first one? Or do I have to tweak any pagination settings?
When retrieving using ID, it works fine, while for Person, it is not. Is there any indexing I need to enable for query to work beyond 20,000?
If you are having more than 5000 items with this person/email "me.someone#company.com", filter condition will fail. This is the limitation of SharePoint and SharePoint REST APIs.
If you have less than 5000 items for this particular email/person, you can try below suggestions:
Add indexing on this person or group column
Add 5000 in Top Count in Get items action
Enable pagination from settings of Get items action and provide number of items you want to fetch.
You can fetch maximum of 100000 items using Get items action.

Order Groups by number of items

I use the tabulator JS library and group my table. How can I order the groups by their number of rows? Eg. the group containing the most items should order at the top.
I do this for sorting dates as the user adds new date-based events. I sort the array after a new event has been added and then use the replaceData function to update the table. Seems to work pretty well performance-wise.
You would have to work out your own routine logic for sorting based on number of group members.
The replaceData function lets you silently replace all data in the
table without updating scroll position, sort or filtering, and without
triggering the ajax loading popup. This is great if you have a table
you want to periodically update with new/updated information without
alerting the user to a change.
mayData.events = sortEventsByDate(mayData.events);
eventTable.replaceData(mayData.events);
function sortEventsByDate(events) {
var sorted = events.sort(function (a, b) {
return new Date(a.startDate).getTime() - new Date(b.startDate).getTime();
});
return sorted;
}

Power BI query to return same-name list results from multiple subsites

We have a SharePoint site that users will create item records as a new subsite with a template. On this template is a list, we'll call List A. There are 90+ of these subsites with the same 'List A' name.
On List A there is a "Status" field with the "Closed" choice. I am looking to make a report (preferably in Table/Excel form) that will query all the 'List A' lists that have a Status field set to 'Closed'.
I am looking at OData queries but I'm very new to Power BI. Any help would be much appreciated!
Thanks!
I would build a query based on one subsite example, using the built-in connector for a SharePoint Online List. I would apply the Status = Closed filter. Then I would replace the hard-coded Site with a Query Parameter.
Now you can right-click that Query and choose Create Function.
Next you need a Query that lists your 90+ subsites with their URL. There might be an OData query that can do this or you might need to maintain a manual list e.g. in Excel. Then you can add a Custom column that calls the Query Function (created above) and passes each subsite URL.
Expand that table-type Custom column and the result will be the filtered rows from all the subsites.

SharePoint 2010 - Create liste items with looping workflow - limitation of 5?

I have a little problem creating new list items (rows) with the help of a workflow in a list in SharePoint Server 2010. Here are the facts.
What I want to do:
Create an item in a main list. While creating this item, the user has to enter a number which specifies the number of list items that should be created in a secondary list.
When the item in the main list is created, a workflow starts.
This workflow should create the number of list items in the secondary list, that the user specified before.
What I have so far:
As I'm restricted to work with SharePoint Designer, I have no possibility to create a for loop (which, I have to say, is quite weak and annoying beacause it would simplify a lot of things). However, what I have so far is the following and it works to a certain degree:
The workflow on the main list:
This one starts when an item is created or an existing one is updated.
It creates a new list item on the secondary list. Amongst others, it passes the ID of the item that was just created, the number of items which should be created in the secondary list, and a counter value (initial value is 1).
The workflow on the secondary list:
Increases the counter value by 1
Saves the ID of the corresponding list item in the main list.
Saves the number of items which should be created in the secondary list.
And (if the counter is smaller as the items which should be created) updates the counter of the corresponding item in the main list (that's why I passed the ID before).
As the item in the main list is updated, the workflow starts again with the new counter value.
Actually, it's the same principle described in this forum contribution.
The problem:
Now here is the problem: Despite the fact that the loop works, the problem is that only a maximum of 5 items are created in the secondary list, but I never declared that anywhere. For example, if I create an item in the main list and I enter a number of 10, the counter stops at 5 and only 5 items are created in the secondary list. But if I enter a number that is lower than 5, everything works perfect. For example, if I want to create 3 items in the secondary list, it only creates 3 items and the counter stops at 3, as it should.
The question:
As I am quite new to SharePoint (I'm coming from the PHP/SQL-World, where - as you know - loops are absolutely no problem), my question is if there are any predefined limitations in regard of creating list items by a workflow, and if yes, how and where I could change them (if that is possible).
This page says the limit of five is built in to reduce server strain and prevent infinite loops.
I can't find it now, but someone said this could be avoided by adding "Pause for Duration" for a minute as the last step of the looping workflow.

Query problem with lookup column in SharePoint

Setup:
I have two lists on a SharePoint site, A and B. List A has a column 'b' that is a lookup to the ID field of list B. I have 500k+ records in A and about 6k records in B.
What works:
I am able to execute a query for items in list A using SharePoint web services, and am even able to filter the query based on a specific "lookup" value for column 'b'. For example, I can query for items in A whose column b matches 1234 (...<Value Type="Lookup">1234</Value>...), and so on.
What doesn't work:
The query does not work for items older than a specific date, even though my query does not involve dates in any way -- only the lookup column. Any query on data newer than two years old works fine, anything older than that fails. If I view items from the SharePoint web page they appear ok, and all the links from child records in B to parent records in A work just fine -- the lookup columns appear intact.
Question:
Is there some kind of maintenance task in SharePoint that can cause some underlying data to get corrupted that can prevent a query based on a lookup id to stop working, like a system restore, etc? In other words, the lookup column data appears correct on the surface in the web browser. But does SharePoint represent this value with a GUID or other invisible data that might be out of sync or stale?
Thanks.
Maybe you are hitting another limit; the maximum number of items retrieved in a query?
See list throttling
Try querying by the ID by adding the LookupId=”TRUE” attribute to your FieldRef element.
http://abstractspaces.wordpress.com/2008/05/05/caml-query-lookup-field-by-id-not-by-value/
The problem appears to be related to the fact that the column in question was indexed. When I removed the index everything started working. When I reapplied the index, everything kept on working. I'm attributing this problem to a corrupt index.

Resources