I have a list built using web part. I want count of that web part list.
Scenario:
I have List A. Created list B and added web part into it which points to list A.
I want list item count of list B.
I used '/_api/web/lists/GetByTitle('list B')/items'
. But I am getting 0 as count though there are many items.
I don't want to return count of list A. So is there any approach to get count of web part list?
Code
function GetWebPartPageItems(ListName)
{
$.ajax({
url:_spPageContextInfo.webAbsoluteUrl +"/_api/web/lists/GetByTitle('List B')?$select=ItemCount",
type: "GET",
headers: {
"accept": "application/json;odata=verbose",
"content-Type": "application/json;odata=verbose"
},
async:false,
success: function(data) {
console.log(data.d.results);
},
error: function(error) {
alert(JSON.stringify(error));
}
});
}
When url is hit in browser,I get resopnse as:
<?xml version="1.0" encoding="utf-8"?><entry
xml:base="http://sharepoint.brainvire.com/sites/DMS/_api/" xmlns="http://www.w3.org/2005/Atom"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:etag=""40""><id>http://sharepoint.brainvire.com/sites/DMS/_api/Web/Lists(guid'514f92fb-ccd7-497c-81b9-b74fc074ee37')</id><category term="SP.List"
scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link
rel="edit" href="Web/Lists(guid'514f92fb-ccd7-497c-81b9-b74fc074ee37')" /><title />
<updated>2019-08-05T10:34:16Z</updated><author><name /></author>
<content type="application/xml"><m:properties><d:ItemCount m:type="Edm.Int32">0</d:ItemCount>
</m:properties></content></entry>
In list,items are present:
Created list B and added web part into it which points to list A
. Can you please add some details about it?