SharePoint 2016 – REST API, stratswith and ContentTypeId

Occasional Contributor

We run into quite interesting issue. When you use REST API and want to filter results using ContentTypeId in document library, e.g. $filter=startswith(ContentTypeId, ‘0x0120’), it works well until number of document reaches 500 items. Than you get 0 results. Filter works fine when you compare exact content type Id, e.g. $filter=ContentType+eq+’0x0120’.

As it was mentioned in other conversation, you cannot filter on expanded ContentType (SP 2016 only!)

So, you can make RESTcall to library to get content type number from name and then use it in another query.

2 Replies

There might be a threshold limit for `starts with`. Have you tried to get more with paging. Something like:


Get the first 400:


$filter=startswith(ContentTypeId, ‘0x0120’)&$top=400

Then for the next page (400) go with:



$filter=startswith(ContentTypeId, ‘0x0120’)&$top=400&$skip=400



I will try that. Can work. Althought top and skips filters didn't work very well in SP2013, but maybe in SP2016...? Either way, it is worth to try. Thanks for suggestion.