Question

I'm querying list properties using a REST query /_api/Web/Lists?&$select=Title,ItemCount.

ItemCount property returns current count of items but I don't see how to get the maximum allowed count for a SPList : https://msdn.microsoft.com/fr-fr/library/microsoft.sharepoint.splist_members.aspx

Was it helpful?

Solution 2

it looks like the property is not available by querying /_api/Web/Lists but only by querying _api/Web/Lists/SchemaXml then parsing the xml

var url  = __site  + "/_api/Web/Lists(@v0)/SchemaXml?&@v0=guid%27"+listId+"%27";
$.ajax({
    headers:{
        Accept:"application/json;odata=verbose"
    },
    url:url,
    success:function(res){
        var xmlStr = res.d.SchemaXml;
        var doc = new window.DOMParser().parseFromString(xmlStr, "text/xml");
        var xPathRes = document.evaluate ('//@MaxItemsPerThrottledOperation', doc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
        if (xPathRes.singleNodeValue) {
            success(xPathRes.singleNodeValue.textContent);
        }                   
    },
    error:error
});

or simpler by querying /_api/Site/MaxItemsPerThrottledOperation
(thanks ghangas for this one (as found on REST API : different properties list using /_api/Web/Lists/SchemaXml VS /_api/Web/Lists/?))

So it looks like this limit is a property of the site and not per list.
Of course this property is not listed at https://msdn.microsoft.com/fr-fr/library/microsoft.sharepoint.spsite_members.aspx

Why KISS when you can go the MS way?

OTHER TIPS

The maximum is based on you listview treshold setting. Default is it 5000 records.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top